1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
|
'\" te
.\" Copyright 1989 AT&T. Copyright (c) 2004, Sun Microsystems, Inc. All Rights Reserved.
.\" 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.
.\" 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.
.\" 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]
.TH sigsend 2 "19 Jul 2004" "SunOS 5.11" "System Calls"
.SH NAME
sigsend, sigsendset \- send a signal to a process or a group of processes
.SH SYNOPSIS
.LP
.nf
#include <signal.h>
\fBint\fR \fBsigsend\fR(\fBidtype_t\fR \fIidtype\fR, \fBid_t\fR \fIid\fR, \fBint\fR \fIsig\fR);
.fi
.LP
.nf
\fBint\fR \fBsigsendset\fR(\fBprocset_t *\fR\fIpsp\fR, \fBint\fR \fIsig\fR);
.fi
.SH DESCRIPTION
.sp
.LP
The \fBsigsend()\fR function sends a signal to the process or group of
processes specified by \fIid\fR and \fIidtype\fR. The signal to be sent is
specified by \fIsig\fR and is either 0 or one of the values listed in
\fBsignal.h\fR(3HEAD). If \fIsig\fR is 0 (the null signal), error checking is
performed but no signal is actually sent. This value can be used to check the
validity of \fIid\fR and \fIidtype\fR.
.sp
.LP
The real or effective user \fBID\fR of the sending process must match the real
or saved user ID of the receiving process, unless the {\fBPRIV_PROC_OWNER\fR}
privilege is asserted in the effective set of the sending process or \fIsig\fR
is \fBSIGCONT\fR and the sending process has the same session ID as the
receiving process.
.sp
.LP
If \fIidtype\fR is \fBP_PID\fR, \fIsig\fR is sent to the process with process
\fBID\fR \fIid\fR.
.sp
.LP
If \fIidtype\fR is \fBP_PGID\fR, \fIsig\fR is sent to all processes with
process group \fBID\fR \fIid\fR.
.sp
.LP
If \fIidtype\fR is \fBP_SID\fR, \fIsig\fR is sent to all processes with
session \fBID\fR \fIid\fR.
.sp
.LP
If \fIidtype\fR is \fBP_TASKID\fR, \fIsig\fR is sent to all processes with
task \fBID\fR \fIid\fR.
.sp
.LP
If \fIidtype\fR is \fBP_UID\fR, \fIsig\fR is sent to any process with
effective user \fBID\fR \fIid\fR.
.sp
.LP
If \fIidtype\fR is \fBP_GID\fR, \fIsig\fR is sent to any process with
effective group \fBID\fR \fIid\fR.
.sp
.LP
If \fIidtype\fR is \fBP_PROJID\fR, \fIsig\fR is sent to any process with
project \fBID\fR \fIid\fR.
.sp
.LP
If \fIidtype\fR is \fBP_CID\fR, \fIsig\fR is sent to any process with
scheduler class \fBID\fR \fIid\fR (see \fBpriocntl\fR(2)).
.sp
.LP
If \fIidtype\fR is \fBP_CTID\fR, \fIsig\fR is sent to any process with process
contract ID \fIid\fR.
.sp
.LP
If \fIidtype\fR is \fBP_ALL\fR, \fIsig\fR is sent to all processes and
\fIid\fR is ignored.
.sp
.LP
If \fIid\fR is \fBP_MYID\fR, the value of \fIid\fR is taken from the calling
process.
.sp
.LP
The process with a process \fBID\fR of 0 is always excluded. The process with
a process \fBID\fR of 1 is excluded unless \fIidtype\fR is equal to
\fBP_PID\fR.
.sp
.LP
The \fBsigsendset()\fR function provides an alternate interface for sending
signals to sets of processes. This function sends signals to the set of
processes specified by \fIpsp\fR. \fIpsp\fR is a pointer to a structure of type
\fBprocset_t\fR, defined in <\fBsys/procset.h\fR>, which includes the following
members:
.sp
.in +2
.nf
idop_t p_op;
idtype_t p_lidtype;
id_t p_lid;
idtype_t p_ridtype;
id_t p_rid;
.fi
.in -2
.sp
.LP
The \fBp_lidtype\fR and \fBp_lid\fR members specify the \fBID\fR type and
\fBID\fR of one ("left") set of processes; the \fBp_ridtype\fR and \fBp_rid\fR
members specify the \fBID\fR type and \fBID\fR of a second ("right") set of
processes. \fBID\fR types and \fBID\fRs are specified just as for the
\fIidtype\fR and \fIid\fR arguments to \fBsigsend()\fR. The \fBp_op\fR member
specifies the operation to be performed on the two sets of processes to get the
set of processes the function is to apply to. The valid values for \fBp_op\fR
and the processes they specify are:
.sp
.ne 2
.mk
.na
\fB\fBPOP_DIFF\fR\fR
.ad
.RS 12n
.rt
Set difference: processes in left set and not in right set.
.RE
.sp
.ne 2
.mk
.na
\fB\fBPOP_AND\fR\fR
.ad
.RS 12n
.rt
Set intersection: processes in both left and right sets.
.RE
.sp
.ne 2
.mk
.na
\fB\fBPOP_OR\fR\fR
.ad
.RS 12n
.rt
Set union: processes in either left or right set or both.
.RE
.sp
.ne 2
.mk
.na
\fB\fBPOP_XOR\fR\fR
.ad
.RS 12n
.rt
Set exclusive-or: processes in left or right set but not in both.
.RE
.SH RETURN VALUES
.sp
.LP
Upon successful completion, \fB0\fR is return. Otherwise, \fB\(mi1\fR is
returned and \fBerrno\fR is set to indicate the error.
.SH ERRORS
.sp
.LP
The \fBsigsend()\fR and \fBsigsendset()\fR functions will fail if:
.sp
.ne 2
.mk
.na
\fB\fBEINVAL\fR\fR
.ad
.RS 10n
.rt
The \fIsig\fR argument is not a valid signal number, or the \fIidtype\fR
argument is not a valid idtype field.
.RE
.sp
.ne 2
.mk
.na
\fB\fBEINVAL\fR\fR
.ad
.RS 10n
.rt
The \fIsig\fR argument is \fBSIGKILL,\fR \fIidtype\fR is \fBP_PID\fR and
\fIid\fR is \fB1\fR (proc1).
.RE
.sp
.ne 2
.mk
.na
\fB\fBEPERM\fR\fR
.ad
.RS 10n
.rt
The effective user of the calling process does not match the real or saved user
ID of the receiving process, the calling process does not have the
{\fBPRIV_PROC_OWNER\fR} privilege asserted in the effective set, and the
calling process is not sending \fBSIGCONT\fR to a process that shares the same
session ID.
.sp
The calling process does not have the {\fBPRIV_PROC_SESSION\fR} privilege
asserted and is trying to send a signal to a process with a different session
ID, even though the effective user ID matches the real or saved ID of the
receiving process.
.RE
.sp
.ne 2
.mk
.na
\fB\fBESRCH\fR\fR
.ad
.RS 10n
.rt
No process can be found corresponding to that specified by \fIid\fR and
\fIidtype\fR.
.RE
.sp
.LP
The \fBsigsendset()\fR function will fail if:
.sp
.ne 2
.mk
.na
\fB\fBEFAULT\fR\fR
.ad
.RS 10n
.rt
The \fIpsp\fR argument points to an illegal address.
.RE
.SH SEE ALSO
.sp
.LP
\fBkill\fR(1), \fBgetpid\fR(2), \fBkill\fR(2), \fBpriocntl\fR(2),
\fBsignal\fR(3C), \fBsignal.h\fR(3HEAD), \fBprocess\fR(4), \fBprivileges\fR(5)
|