1*7c478bd9Sstevel@tonic-gate /* 2*7c478bd9Sstevel@tonic-gate * CDDL HEADER START 3*7c478bd9Sstevel@tonic-gate * 4*7c478bd9Sstevel@tonic-gate * The contents of this file are subject to the terms of the 5*7c478bd9Sstevel@tonic-gate * Common Development and Distribution License, Version 1.0 only 6*7c478bd9Sstevel@tonic-gate * (the "License"). You may not use this file except in compliance 7*7c478bd9Sstevel@tonic-gate * with the License. 8*7c478bd9Sstevel@tonic-gate * 9*7c478bd9Sstevel@tonic-gate * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE 10*7c478bd9Sstevel@tonic-gate * or http://www.opensolaris.org/os/licensing. 11*7c478bd9Sstevel@tonic-gate * See the License for the specific language governing permissions 12*7c478bd9Sstevel@tonic-gate * and limitations under the License. 13*7c478bd9Sstevel@tonic-gate * 14*7c478bd9Sstevel@tonic-gate * When distributing Covered Code, include this CDDL HEADER in each 15*7c478bd9Sstevel@tonic-gate * file and include the License file at usr/src/OPENSOLARIS.LICENSE. 16*7c478bd9Sstevel@tonic-gate * If applicable, add the following below this CDDL HEADER, with the 17*7c478bd9Sstevel@tonic-gate * fields enclosed by brackets "[]" replaced with your own identifying 18*7c478bd9Sstevel@tonic-gate * information: Portions Copyright [yyyy] [name of copyright owner] 19*7c478bd9Sstevel@tonic-gate * 20*7c478bd9Sstevel@tonic-gate * CDDL HEADER END 21*7c478bd9Sstevel@tonic-gate */ 22*7c478bd9Sstevel@tonic-gate /* 23*7c478bd9Sstevel@tonic-gate * Copyright 2004 Sun Microsystems, Inc. All rights reserved. 24*7c478bd9Sstevel@tonic-gate * Use is subject to license terms. 25*7c478bd9Sstevel@tonic-gate */ 26*7c478bd9Sstevel@tonic-gate 27*7c478bd9Sstevel@tonic-gate /* Copyright (c) 1984, 1986, 1987, 1988, 1989 AT&T */ 28*7c478bd9Sstevel@tonic-gate /* All Rights Reserved */ 29*7c478bd9Sstevel@tonic-gate 30*7c478bd9Sstevel@tonic-gate 31*7c478bd9Sstevel@tonic-gate #ifndef _SYS_PROCSET_H 32*7c478bd9Sstevel@tonic-gate #define _SYS_PROCSET_H 33*7c478bd9Sstevel@tonic-gate 34*7c478bd9Sstevel@tonic-gate #pragma ident "%Z%%M% %I% %E% SMI" /* SVr4.0 1.6 */ 35*7c478bd9Sstevel@tonic-gate 36*7c478bd9Sstevel@tonic-gate #ifdef __cplusplus 37*7c478bd9Sstevel@tonic-gate extern "C" { 38*7c478bd9Sstevel@tonic-gate #endif 39*7c478bd9Sstevel@tonic-gate 40*7c478bd9Sstevel@tonic-gate #include <sys/feature_tests.h> 41*7c478bd9Sstevel@tonic-gate #include <sys/types.h> 42*7c478bd9Sstevel@tonic-gate #include <sys/signal.h> 43*7c478bd9Sstevel@tonic-gate 44*7c478bd9Sstevel@tonic-gate /* 45*7c478bd9Sstevel@tonic-gate * This file defines the data needed to specify a set of 46*7c478bd9Sstevel@tonic-gate * processes. These types are used by the sigsend, sigsendset, 47*7c478bd9Sstevel@tonic-gate * priocntl, priocntlset, waitid, evexit, and evexitset system 48*7c478bd9Sstevel@tonic-gate * calls. 49*7c478bd9Sstevel@tonic-gate */ 50*7c478bd9Sstevel@tonic-gate #define P_INITPID 1 51*7c478bd9Sstevel@tonic-gate #define P_INITUID 0 52*7c478bd9Sstevel@tonic-gate #define P_INITPGID 0 53*7c478bd9Sstevel@tonic-gate 54*7c478bd9Sstevel@tonic-gate 55*7c478bd9Sstevel@tonic-gate /* 56*7c478bd9Sstevel@tonic-gate * The following defines the values for an identifier type. It 57*7c478bd9Sstevel@tonic-gate * specifies the interpretation of an id value. An idtype and 58*7c478bd9Sstevel@tonic-gate * id together define a simple set of processes. 59*7c478bd9Sstevel@tonic-gate */ 60*7c478bd9Sstevel@tonic-gate typedef enum 61*7c478bd9Sstevel@tonic-gate #if !defined(_XPG4_2) || defined(__EXTENSIONS__) 62*7c478bd9Sstevel@tonic-gate idtype /* pollutes XPG4.2 namespace */ 63*7c478bd9Sstevel@tonic-gate #endif 64*7c478bd9Sstevel@tonic-gate { 65*7c478bd9Sstevel@tonic-gate P_PID, /* A process identifier. */ 66*7c478bd9Sstevel@tonic-gate P_PPID, /* A parent process identifier. */ 67*7c478bd9Sstevel@tonic-gate P_PGID, /* A process group (job control group) */ 68*7c478bd9Sstevel@tonic-gate /* identifier. */ 69*7c478bd9Sstevel@tonic-gate P_SID, /* A session identifier. */ 70*7c478bd9Sstevel@tonic-gate P_CID, /* A scheduling class identifier. */ 71*7c478bd9Sstevel@tonic-gate P_UID, /* A user identifier. */ 72*7c478bd9Sstevel@tonic-gate P_GID, /* A group identifier. */ 73*7c478bd9Sstevel@tonic-gate P_ALL, /* All processes. */ 74*7c478bd9Sstevel@tonic-gate P_LWPID, /* An LWP identifier. */ 75*7c478bd9Sstevel@tonic-gate P_TASKID, /* A task identifier. */ 76*7c478bd9Sstevel@tonic-gate P_PROJID, /* A project identifier. */ 77*7c478bd9Sstevel@tonic-gate P_POOLID, /* A pool identifier. */ 78*7c478bd9Sstevel@tonic-gate P_ZONEID, /* A zone identifier. */ 79*7c478bd9Sstevel@tonic-gate P_CTID, /* A (process) contract identifier. */ 80*7c478bd9Sstevel@tonic-gate P_CPUID, /* CPU identifier. */ 81*7c478bd9Sstevel@tonic-gate P_PSETID /* Processor set identifier */ 82*7c478bd9Sstevel@tonic-gate } idtype_t; 83*7c478bd9Sstevel@tonic-gate 84*7c478bd9Sstevel@tonic-gate 85*7c478bd9Sstevel@tonic-gate /* 86*7c478bd9Sstevel@tonic-gate * The following defines the operations which can be performed to 87*7c478bd9Sstevel@tonic-gate * combine two simple sets of processes to form another set of 88*7c478bd9Sstevel@tonic-gate * processes. 89*7c478bd9Sstevel@tonic-gate */ 90*7c478bd9Sstevel@tonic-gate #if !defined(_XPG4_2) || defined(__EXTENSIONS__) 91*7c478bd9Sstevel@tonic-gate typedef enum idop { 92*7c478bd9Sstevel@tonic-gate POP_DIFF, /* Set difference. The processes which */ 93*7c478bd9Sstevel@tonic-gate /* are in the left operand set and not */ 94*7c478bd9Sstevel@tonic-gate /* in the right operand set. */ 95*7c478bd9Sstevel@tonic-gate POP_AND, /* Set disjunction. The processes */ 96*7c478bd9Sstevel@tonic-gate /* which are in both the left and right */ 97*7c478bd9Sstevel@tonic-gate /* operand sets. */ 98*7c478bd9Sstevel@tonic-gate POP_OR, /* Set conjunction. The processes */ 99*7c478bd9Sstevel@tonic-gate /* which are in either the left or the */ 100*7c478bd9Sstevel@tonic-gate /* right operand sets (or both). */ 101*7c478bd9Sstevel@tonic-gate POP_XOR /* Set exclusive or. The processes */ 102*7c478bd9Sstevel@tonic-gate /* which are in either the left or */ 103*7c478bd9Sstevel@tonic-gate /* right operand sets but not in both. */ 104*7c478bd9Sstevel@tonic-gate } idop_t; 105*7c478bd9Sstevel@tonic-gate 106*7c478bd9Sstevel@tonic-gate 107*7c478bd9Sstevel@tonic-gate /* 108*7c478bd9Sstevel@tonic-gate * The following structure is used to define a set of processes. 109*7c478bd9Sstevel@tonic-gate * The set is defined in terms of two simple sets of processes 110*7c478bd9Sstevel@tonic-gate * and an operator which operates on these two operand sets. 111*7c478bd9Sstevel@tonic-gate */ 112*7c478bd9Sstevel@tonic-gate typedef struct procset { 113*7c478bd9Sstevel@tonic-gate idop_t p_op; /* The operator connection the */ 114*7c478bd9Sstevel@tonic-gate /* following two operands each */ 115*7c478bd9Sstevel@tonic-gate /* of which is a simple set of */ 116*7c478bd9Sstevel@tonic-gate /* processes. */ 117*7c478bd9Sstevel@tonic-gate 118*7c478bd9Sstevel@tonic-gate idtype_t p_lidtype; 119*7c478bd9Sstevel@tonic-gate /* The type of the left operand */ 120*7c478bd9Sstevel@tonic-gate /* simple set. */ 121*7c478bd9Sstevel@tonic-gate id_t p_lid; /* The id of the left operand. */ 122*7c478bd9Sstevel@tonic-gate 123*7c478bd9Sstevel@tonic-gate idtype_t p_ridtype; 124*7c478bd9Sstevel@tonic-gate /* The type of the right */ 125*7c478bd9Sstevel@tonic-gate /* operand simple set. */ 126*7c478bd9Sstevel@tonic-gate id_t p_rid; /* The id of the right operand. */ 127*7c478bd9Sstevel@tonic-gate } procset_t; 128*7c478bd9Sstevel@tonic-gate 129*7c478bd9Sstevel@tonic-gate /* 130*7c478bd9Sstevel@tonic-gate * The following macro can be used to initialize a procset_t 131*7c478bd9Sstevel@tonic-gate * structure. 132*7c478bd9Sstevel@tonic-gate */ 133*7c478bd9Sstevel@tonic-gate #define setprocset(psp, op, ltype, lid, rtype, rid) \ 134*7c478bd9Sstevel@tonic-gate (psp)->p_op = (op); \ 135*7c478bd9Sstevel@tonic-gate (psp)->p_lidtype = (ltype); \ 136*7c478bd9Sstevel@tonic-gate (psp)->p_lid = (lid); \ 137*7c478bd9Sstevel@tonic-gate (psp)->p_ridtype = (rtype); \ 138*7c478bd9Sstevel@tonic-gate (psp)->p_rid = (rid); 139*7c478bd9Sstevel@tonic-gate 140*7c478bd9Sstevel@tonic-gate #endif /* !defined(_XPG4_2) || defined(__EXTENSIONS__) */ 141*7c478bd9Sstevel@tonic-gate 142*7c478bd9Sstevel@tonic-gate #ifdef _KERNEL 143*7c478bd9Sstevel@tonic-gate 144*7c478bd9Sstevel@tonic-gate struct proc; 145*7c478bd9Sstevel@tonic-gate 146*7c478bd9Sstevel@tonic-gate extern int dotoprocs(procset_t *, int (*)(), char *); 147*7c478bd9Sstevel@tonic-gate extern int dotolwp(procset_t *, int (*)(), char *); 148*7c478bd9Sstevel@tonic-gate extern int procinset(struct proc *, procset_t *); 149*7c478bd9Sstevel@tonic-gate extern int sigsendproc(struct proc *, sigsend_t *); 150*7c478bd9Sstevel@tonic-gate extern int sigsendset(procset_t *, sigsend_t *); 151*7c478bd9Sstevel@tonic-gate extern boolean_t cur_inset_only(procset_t *); 152*7c478bd9Sstevel@tonic-gate extern id_t getmyid(idtype_t); 153*7c478bd9Sstevel@tonic-gate 154*7c478bd9Sstevel@tonic-gate #endif /* _KERNEL */ 155*7c478bd9Sstevel@tonic-gate 156*7c478bd9Sstevel@tonic-gate #ifdef __cplusplus 157*7c478bd9Sstevel@tonic-gate } 158*7c478bd9Sstevel@tonic-gate #endif 159*7c478bd9Sstevel@tonic-gate 160*7c478bd9Sstevel@tonic-gate #endif /* _SYS_PROCSET_H */ 161