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