xref: /onnv-gate/usr/src/uts/common/sys/contract/process_impl.h (revision 6073:47f6aa7a8077)
10Sstevel@tonic-gate /*
20Sstevel@tonic-gate  * CDDL HEADER START
30Sstevel@tonic-gate  *
40Sstevel@tonic-gate  * The contents of this file are subject to the terms of the
5*6073Sacruz  * Common Development and Distribution License (the "License").
6*6073Sacruz  * You may not use this file except in compliance with the License.
70Sstevel@tonic-gate  *
80Sstevel@tonic-gate  * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
90Sstevel@tonic-gate  * or http://www.opensolaris.org/os/licensing.
100Sstevel@tonic-gate  * See the License for the specific language governing permissions
110Sstevel@tonic-gate  * and limitations under the License.
120Sstevel@tonic-gate  *
130Sstevel@tonic-gate  * When distributing Covered Code, include this CDDL HEADER in each
140Sstevel@tonic-gate  * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
150Sstevel@tonic-gate  * If applicable, add the following below this CDDL HEADER, with the
160Sstevel@tonic-gate  * fields enclosed by brackets "[]" replaced with your own identifying
170Sstevel@tonic-gate  * information: Portions Copyright [yyyy] [name of copyright owner]
180Sstevel@tonic-gate  *
190Sstevel@tonic-gate  * CDDL HEADER END
200Sstevel@tonic-gate  */
210Sstevel@tonic-gate /*
22*6073Sacruz  * Copyright 2008 Sun Microsystems, Inc.  All rights reserved.
230Sstevel@tonic-gate  * Use is subject to license terms.
240Sstevel@tonic-gate  */
250Sstevel@tonic-gate 
260Sstevel@tonic-gate #ifndef	_SYS_CONTRACT_PROCESS_IMPL_H
270Sstevel@tonic-gate #define	_SYS_CONTRACT_PROCESS_IMPL_H
280Sstevel@tonic-gate 
290Sstevel@tonic-gate #pragma ident	"%Z%%M%	%I%	%E% SMI"
300Sstevel@tonic-gate 
310Sstevel@tonic-gate #include <sys/contract.h>
320Sstevel@tonic-gate #include <sys/contract_impl.h>
330Sstevel@tonic-gate #include <sys/contract/process.h>
340Sstevel@tonic-gate #include <sys/time.h>
35*6073Sacruz #include <sys/types.h>
36*6073Sacruz #include <sys/refstr.h>
370Sstevel@tonic-gate 
380Sstevel@tonic-gate #ifdef	__cplusplus
390Sstevel@tonic-gate extern "C" {
400Sstevel@tonic-gate #endif
410Sstevel@tonic-gate 
420Sstevel@tonic-gate #define	PRCTID(pp) \
430Sstevel@tonic-gate 	((pp)->p_ct_process ? (pp)->p_ct_process->conp_contract.ct_id : 0)
440Sstevel@tonic-gate 
450Sstevel@tonic-gate struct ctmpl_process {
460Sstevel@tonic-gate 	ct_template_t	ctp_ctmpl;
470Sstevel@tonic-gate 	contract_t	*ctp_subsume;
480Sstevel@tonic-gate 	uint_t		ctp_params;
490Sstevel@tonic-gate 	uint_t		ctp_ev_fatal;
50*6073Sacruz 	refstr_t	*ctp_svc_fmri;	/* Service FMRI */
51*6073Sacruz 	refstr_t	*ctp_svc_aux;	/* Creator Auxiliary field */
520Sstevel@tonic-gate };
530Sstevel@tonic-gate 
540Sstevel@tonic-gate struct cont_process {
550Sstevel@tonic-gate 	contract_t	conp_contract;	/* common contract data */
560Sstevel@tonic-gate 	cred_t		*conp_cred;
570Sstevel@tonic-gate 	list_t		conp_members;	/* member processes */
580Sstevel@tonic-gate 	list_t		conp_inherited;	/* unclaimed child contracts */
590Sstevel@tonic-gate 	uint_t		conp_params;	/* contract parameters */
600Sstevel@tonic-gate 	uint_t		conp_ev_fatal;	/* events to kill on */
610Sstevel@tonic-gate 	uint_t		conp_nmembers;
620Sstevel@tonic-gate 	uint_t		conp_ninherited;
63*6073Sacruz 	refstr_t	*conp_svc_fmri;		/* Service FMRI */
64*6073Sacruz 	ctid_t		conp_svc_ctid;		/* Service FMRI creator ctid */
65*6073Sacruz 	refstr_t	*conp_svc_creator;	/* contract creator */
66*6073Sacruz 	refstr_t	*conp_svc_aux;		/* Creator Auxiliary field */
67*6073Sacruz 	ctid_t		conp_svc_zone_enter;	/* zone_enter flag */
68*6073Sacruz 						/* requires ct_lock for */
69*6073Sacruz 						/* access */
700Sstevel@tonic-gate };
710Sstevel@tonic-gate 
720Sstevel@tonic-gate /*
730Sstevel@tonic-gate  * Kernel APIs
740Sstevel@tonic-gate  */
750Sstevel@tonic-gate ctmpl_process_t *sys_process_tmpl;
760Sstevel@tonic-gate ct_type_t *process_type;
770Sstevel@tonic-gate 
780Sstevel@tonic-gate struct proc;
790Sstevel@tonic-gate void contract_process_init(void);
800Sstevel@tonic-gate cont_process_t *contract_process_fork(ctmpl_process_t *, struct proc *,
810Sstevel@tonic-gate     struct proc *, int);
820Sstevel@tonic-gate void contract_process_exit(cont_process_t *, struct proc *, int);
830Sstevel@tonic-gate void contract_process_core(cont_process_t *, struct proc *, int,
840Sstevel@tonic-gate     const char *, const char *, const char *);
850Sstevel@tonic-gate void contract_process_hwerr(cont_process_t *, struct proc *);
860Sstevel@tonic-gate void contract_process_sig(cont_process_t *, struct proc *, int, pid_t, ctid_t,
870Sstevel@tonic-gate     zoneid_t);
880Sstevel@tonic-gate void contract_process_take(contract_t *, contract_t *);
890Sstevel@tonic-gate int contract_process_accept(contract_t *);
900Sstevel@tonic-gate void contract_process_adopt(contract_t *, proc_t *);
910Sstevel@tonic-gate 
920Sstevel@tonic-gate #ifdef	__cplusplus
930Sstevel@tonic-gate }
940Sstevel@tonic-gate #endif
950Sstevel@tonic-gate 
960Sstevel@tonic-gate #endif	/* _SYS_CONTRACT_PROCESS_IMPL_H */
97