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