8815 mega_sas: variable set but not used
[unleashed.git] / usr / src / man / man2 / sigsend.2
blob2801dda2b0af1ac0ddc7dcb44fa321a21e45a2b2
1 '\" te
2 .\" Copyright 1989 AT&T.  Copyright (c) 2004, Sun Microsystems, Inc.  All Rights Reserved.
3 .\" The contents of this file are subject to the terms of the Common Development and Distribution License (the "License").  You may not use this file except in compliance with the License.
4 .\" You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE or http://www.opensolaris.org/os/licensing.  See the License for the specific language governing permissions and limitations under the License.
5 .\" When distributing Covered Code, include this CDDL HEADER in each file and include the License file at usr/src/OPENSOLARIS.LICENSE.  If applicable, add the following below this CDDL HEADER, with the fields enclosed by brackets "[]" replaced with your own identifying information: Portions Copyright [yyyy] [name of copyright owner]
6 .TH SIGSEND 2 "Jul 19, 2004"
7 .SH NAME
8 sigsend, sigsendset \- send a signal to a process or a group of processes
9 .SH SYNOPSIS
10 .LP
11 .nf
12 #include <signal.h>
14 \fBint\fR \fBsigsend\fR(\fBidtype_t\fR \fIidtype\fR, \fBid_t\fR \fIid\fR, \fBint\fR \fIsig\fR);
15 .fi
17 .LP
18 .nf
19 \fBint\fR \fBsigsendset\fR(\fBprocset_t *\fR\fIpsp\fR, \fBint\fR \fIsig\fR);
20 .fi
22 .SH DESCRIPTION
23 .sp
24 .LP
25 The \fBsigsend()\fR function sends a signal to the process or group of
26 processes specified by \fIid\fR and \fIidtype\fR. The signal to be sent is
27 specified by \fIsig\fR and is either  0 or one of the values listed in
28 \fBsignal.h\fR(3HEAD). If \fIsig\fR is  0 (the null signal), error checking is
29 performed but no signal is actually sent.  This value can be used to check the
30 validity of \fIid\fR and  \fIidtype\fR.
31 .sp
32 .LP
33 The real or effective user \fBID\fR of the sending process must match the real
34 or saved user ID of the receiving process, unless the {\fBPRIV_PROC_OWNER\fR}
35 privilege is asserted in the effective set of the sending process or \fIsig\fR
36 is \fBSIGCONT\fR and the sending  process has the same session ID as the
37 receiving process.
38 .sp
39 .LP
40 If \fIidtype\fR is  \fBP_PID\fR, \fIsig\fR is sent to the process with process
41 \fBID\fR \fIid\fR.
42 .sp
43 .LP
44 If \fIidtype\fR is  \fBP_PGID\fR, \fIsig\fR is sent to all processes with
45 process group \fBID\fR \fIid\fR.
46 .sp
47 .LP
48 If \fIidtype\fR is  \fBP_SID\fR, \fIsig\fR is sent to all processes with
49 session \fBID\fR \fIid\fR.
50 .sp
51 .LP
52 If \fIidtype\fR is  \fBP_TASKID\fR, \fIsig\fR is sent to all processes with
53 task \fBID\fR \fIid\fR.
54 .sp
55 .LP
56 If \fIidtype\fR is  \fBP_UID\fR, \fIsig\fR is sent to any process with
57 effective user \fBID\fR \fIid\fR.
58 .sp
59 .LP
60 If \fIidtype\fR is  \fBP_GID\fR, \fIsig\fR is sent to any process with
61 effective group \fBID\fR \fIid\fR.
62 .sp
63 .LP
64 If \fIidtype\fR is  \fBP_PROJID\fR, \fIsig\fR is sent to any process with
65 project \fBID\fR \fIid\fR.
66 .sp
67 .LP
68 If \fIidtype\fR is  \fBP_CID\fR, \fIsig\fR is sent to any process with
69 scheduler class \fBID\fR \fIid\fR (see \fBpriocntl\fR(2)).
70 .sp
71 .LP
72 If \fIidtype\fR is  \fBP_CTID\fR, \fIsig\fR is sent to any process with process
73 contract ID \fIid\fR.
74 .sp
75 .LP
76 If \fIidtype\fR is  \fBP_ALL\fR, \fIsig\fR is sent to all processes and
77 \fIid\fR is ignored.
78 .sp
79 .LP
80 If \fIid\fR is  \fBP_MYID\fR, the value of \fIid\fR is taken from the calling
81 process.
82 .sp
83 .LP
84 The process with a process \fBID\fR of 0 is always excluded.  The process with
85 a process \fBID\fR of 1 is excluded unless \fIidtype\fR is equal to
86 \fBP_PID\fR.
87 .sp
88 .LP
89 The \fBsigsendset()\fR function provides an alternate interface for sending
90 signals to sets of processes. This function sends signals to the set of
91 processes specified by \fIpsp\fR. \fIpsp\fR is a pointer to a structure of type
92 \fBprocset_t\fR, defined in <\fBsys/procset.h\fR>, which includes the following
93 members:
94 .sp
95 .in +2
96 .nf
97 idop_t    p_op;
98 idtype_t  p_lidtype;
99 id_t      p_lid;
100 idtype_t  p_ridtype;
101 id_t      p_rid;
103 .in -2
107 The \fBp_lidtype\fR and \fBp_lid\fR members specify the \fBID\fR type and
108 \fBID\fR of one ("left") set of processes; the \fBp_ridtype\fR and \fBp_rid\fR
109 members specify the \fBID\fR type and \fBID\fR of a second ("right") set of
110 processes. \fBID\fR types and \fBID\fRs are specified just as for the
111 \fIidtype\fR and \fIid\fR arguments to \fBsigsend()\fR. The \fBp_op\fR member
112 specifies the operation to be performed on the two sets of processes to get the
113 set of processes the function is to apply to. The valid values for \fBp_op\fR
114 and the processes they specify are:
116 .ne 2
118 \fB\fBPOP_DIFF\fR\fR
120 .RS 12n
121 Set difference: processes in left set and not in right set.
125 .ne 2
127 \fB\fBPOP_AND\fR\fR
129 .RS 12n
130 Set intersection: processes in both left and right sets.
134 .ne 2
136 \fB\fBPOP_OR\fR\fR
138 .RS 12n
139 Set union: processes in either left or right set or both.
143 .ne 2
145 \fB\fBPOP_XOR\fR\fR
147 .RS 12n
148 Set exclusive-or: processes in left or right set but not in both.
151 .SH RETURN VALUES
154 Upon successful completion, \fB0\fR is return.  Otherwise, \fB\(mi1\fR is
155 returned and \fBerrno\fR is set to indicate the error.
156 .SH ERRORS
159 The \fBsigsend()\fR and \fBsigsendset()\fR functions will fail if:
161 .ne 2
163 \fB\fBEINVAL\fR\fR
165 .RS 10n
166 The \fIsig\fR argument is not a valid signal number, or the \fIidtype\fR
167 argument is not a valid idtype field.
171 .ne 2
173 \fB\fBEINVAL\fR\fR
175 .RS 10n
176 The \fIsig\fR argument is  \fBSIGKILL,\fR \fIidtype\fR is  \fBP_PID\fR and
177 \fIid\fR is  \fB1\fR (proc1).
181 .ne 2
183 \fB\fBEPERM\fR\fR
185 .RS 10n
186 The effective user of the calling process does not match the real or saved user
187 ID of the receiving process, the calling process does not have the
188 {\fBPRIV_PROC_OWNER\fR} privilege asserted in the effective set, and the
189 calling process is not sending \fBSIGCONT\fR to a process that shares the same
190 session ID.
192 The calling process does not have the {\fBPRIV_PROC_SESSION\fR} privilege
193 asserted and is trying to send a signal to a process with a different session
194 ID, even though the effective user ID matches the real or saved ID of the
195 receiving process.
199 .ne 2
201 \fB\fBESRCH\fR\fR
203 .RS 10n
204 No process can be found corresponding to that specified by \fIid\fR and
205 \fIidtype\fR.
210 The  \fBsigsendset()\fR function will fail if:
212 .ne 2
214 \fB\fBEFAULT\fR\fR
216 .RS 10n
217 The \fIpsp\fR argument points to an illegal address.
220 .SH SEE ALSO
223 \fBkill\fR(1), \fBgetpid\fR(2), \fBkill\fR(2), \fBpriocntl\fR(2),
224 \fBsignal\fR(3C), \fBsignal.h\fR(3HEAD), \fBprocess\fR(4), \fBprivileges\fR(5)