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 5*7b209c2cSacruz * Common Development and Distribution License (the "License"). 6*7b209c2cSacruz * 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_PROCESS_IMPL_H 277c478bd9Sstevel@tonic-gate #define _SYS_CONTRACT_PROCESS_IMPL_H 287c478bd9Sstevel@tonic-gate 297c478bd9Sstevel@tonic-gate #pragma ident "%Z%%M% %I% %E% SMI" 307c478bd9Sstevel@tonic-gate 317c478bd9Sstevel@tonic-gate #include <sys/contract.h> 327c478bd9Sstevel@tonic-gate #include <sys/contract_impl.h> 337c478bd9Sstevel@tonic-gate #include <sys/contract/process.h> 347c478bd9Sstevel@tonic-gate #include <sys/time.h> 35*7b209c2cSacruz #include <sys/types.h> 36*7b209c2cSacruz #include <sys/refstr.h> 377c478bd9Sstevel@tonic-gate 387c478bd9Sstevel@tonic-gate #ifdef __cplusplus 397c478bd9Sstevel@tonic-gate extern "C" { 407c478bd9Sstevel@tonic-gate #endif 417c478bd9Sstevel@tonic-gate 427c478bd9Sstevel@tonic-gate #define PRCTID(pp) \ 437c478bd9Sstevel@tonic-gate ((pp)->p_ct_process ? (pp)->p_ct_process->conp_contract.ct_id : 0) 447c478bd9Sstevel@tonic-gate 457c478bd9Sstevel@tonic-gate struct ctmpl_process { 467c478bd9Sstevel@tonic-gate ct_template_t ctp_ctmpl; 477c478bd9Sstevel@tonic-gate contract_t *ctp_subsume; 487c478bd9Sstevel@tonic-gate uint_t ctp_params; 497c478bd9Sstevel@tonic-gate uint_t ctp_ev_fatal; 50*7b209c2cSacruz refstr_t *ctp_svc_fmri; /* Service FMRI */ 51*7b209c2cSacruz refstr_t *ctp_svc_aux; /* Creator Auxiliary field */ 527c478bd9Sstevel@tonic-gate }; 537c478bd9Sstevel@tonic-gate 547c478bd9Sstevel@tonic-gate struct cont_process { 557c478bd9Sstevel@tonic-gate contract_t conp_contract; /* common contract data */ 567c478bd9Sstevel@tonic-gate cred_t *conp_cred; 577c478bd9Sstevel@tonic-gate list_t conp_members; /* member processes */ 587c478bd9Sstevel@tonic-gate list_t conp_inherited; /* unclaimed child contracts */ 597c478bd9Sstevel@tonic-gate uint_t conp_params; /* contract parameters */ 607c478bd9Sstevel@tonic-gate uint_t conp_ev_fatal; /* events to kill on */ 617c478bd9Sstevel@tonic-gate uint_t conp_nmembers; 627c478bd9Sstevel@tonic-gate uint_t conp_ninherited; 63*7b209c2cSacruz refstr_t *conp_svc_fmri; /* Service FMRI */ 64*7b209c2cSacruz ctid_t conp_svc_ctid; /* Service FMRI creator ctid */ 65*7b209c2cSacruz refstr_t *conp_svc_creator; /* contract creator */ 66*7b209c2cSacruz refstr_t *conp_svc_aux; /* Creator Auxiliary field */ 67*7b209c2cSacruz ctid_t conp_svc_zone_enter; /* zone_enter flag */ 68*7b209c2cSacruz /* requires ct_lock for */ 69*7b209c2cSacruz /* access */ 707c478bd9Sstevel@tonic-gate }; 717c478bd9Sstevel@tonic-gate 727c478bd9Sstevel@tonic-gate /* 737c478bd9Sstevel@tonic-gate * Kernel APIs 747c478bd9Sstevel@tonic-gate */ 757c478bd9Sstevel@tonic-gate ctmpl_process_t *sys_process_tmpl; 767c478bd9Sstevel@tonic-gate ct_type_t *process_type; 777c478bd9Sstevel@tonic-gate 787c478bd9Sstevel@tonic-gate struct proc; 797c478bd9Sstevel@tonic-gate void contract_process_init(void); 807c478bd9Sstevel@tonic-gate cont_process_t *contract_process_fork(ctmpl_process_t *, struct proc *, 817c478bd9Sstevel@tonic-gate struct proc *, int); 827c478bd9Sstevel@tonic-gate void contract_process_exit(cont_process_t *, struct proc *, int); 837c478bd9Sstevel@tonic-gate void contract_process_core(cont_process_t *, struct proc *, int, 847c478bd9Sstevel@tonic-gate const char *, const char *, const char *); 857c478bd9Sstevel@tonic-gate void contract_process_hwerr(cont_process_t *, struct proc *); 867c478bd9Sstevel@tonic-gate void contract_process_sig(cont_process_t *, struct proc *, int, pid_t, ctid_t, 877c478bd9Sstevel@tonic-gate zoneid_t); 887c478bd9Sstevel@tonic-gate void contract_process_take(contract_t *, contract_t *); 897c478bd9Sstevel@tonic-gate int contract_process_accept(contract_t *); 907c478bd9Sstevel@tonic-gate void contract_process_adopt(contract_t *, proc_t *); 917c478bd9Sstevel@tonic-gate 927c478bd9Sstevel@tonic-gate #ifdef __cplusplus 937c478bd9Sstevel@tonic-gate } 947c478bd9Sstevel@tonic-gate #endif 957c478bd9Sstevel@tonic-gate 967c478bd9Sstevel@tonic-gate #endif /* _SYS_CONTRACT_PROCESS_IMPL_H */ 97