1sigsend(2) System Calls sigsend(2)
2
3
4
6 sigsend, sigsendset - send a signal to a process or a group of pro‐
7 cesses
8
10 #include <signal.h>
11
12 int sigsend(idtype_t idtype, id_t id, int sig);
13
14
15 int sigsendset(procset_t *psp, int sig);
16
17
19 The sigsend() function sends a signal to the process or group of pro‐
20 cesses specified by id and idtype. The signal to be sent is specified
21 by sig and is either 0 or one of the values listed in signal.h(3HEAD).
22 If sig is 0 (the null signal), error checking is performed but no sig‐
23 nal is actually sent. This value can be used to check the validity of
24 id and idtype.
25
26
27 The real or effective user ID of the sending process must match the
28 real or saved user ID of the receiving process, unless the
29 {PRIV_PROC_OWNER} privilege is asserted in the effective set of the
30 sending process or sig is SIGCONT and the sending process has the same
31 session ID as the receiving process.
32
33
34 If idtype is P_PID, sig is sent to the process with process ID id.
35
36
37 If idtype is P_PGID, sig is sent to all processes with process group
38 ID id.
39
40
41 If idtype is P_SID, sig is sent to all processes with session ID id.
42
43
44 If idtype is P_TASKID, sig is sent to all processes with task ID id.
45
46
47 If idtype is P_UID, sig is sent to any process with effective user ID
48 id.
49
50
51 If idtype is P_GID, sig is sent to any process with effective group ID
52 id.
53
54
55 If idtype is P_PROJID, sig is sent to any process with project ID id.
56
57
58 If idtype is P_CID, sig is sent to any process with scheduler class
59 ID id (see priocntl(2)).
60
61
62 If idtype is P_CTID, sig is sent to any process with process contract
63 ID id.
64
65
66 If idtype is P_ALL, sig is sent to all processes and id is ignored.
67
68
69 If id is P_MYID, the value of id is taken from the calling process.
70
71
72 The process with a process ID of 0 is always excluded. The process
73 with a process ID of 1 is excluded unless idtype is equal to P_PID.
74
75
76 The sigsendset() function provides an alternate interface for sending
77 signals to sets of processes. This function sends signals to the set of
78 processes specified by psp. psp is a pointer to a structure of type
79 procset_t, defined in <sys/procset.h>, which includes the following
80 members:
81
82 idop_t p_op;
83 idtype_t p_lidtype;
84 id_t p_lid;
85 idtype_t p_ridtype;
86 id_t p_rid;
87
88
89
90 The p_lidtype and p_lid members specify the ID type and ID of one
91 ("left") set of processes; the p_ridtype and p_rid members specify the
92 ID type and ID of a second ("right") set of processes. ID types and IDs
93 are specified just as for the idtype and id arguments to sigsend(). The
94 p_op member specifies the operation to be performed on the two sets of
95 processes to get the set of processes the function is to apply to. The
96 valid values for p_op and the processes they specify are:
97
98 POP_DIFF Set difference: processes in left set and not in right set.
99
100
101 POP_AND Set intersection: processes in both left and right sets.
102
103
104 POP_OR Set union: processes in either left or right set or both.
105
106
107 POP_XOR Set exclusive-or: processes in left or right set but not in
108 both.
109
110
112 Upon successful completion, 0 is return. Otherwise, −1 is returned and
113 errno is set to indicate the error.
114
116 The sigsend() and sigsendset() functions will fail if:
117
118 EINVAL The sig argument is not a valid signal number, or the idtype
119 argument is not a valid idtype field.
120
121
122 EINVAL The sig argument is SIGKILL, idtype is P_PID and id is 1
123 (proc1).
124
125
126 EPERM The effective user of the calling process does not match the
127 real or saved user ID of the receiving process, the calling
128 process does not have the {PRIV_PROC_OWNER} privilege
129 asserted in the effective set, and the calling process is not
130 sending SIGCONT to a process that shares the same session ID.
131
132 The calling process does not have the {PRIV_PROC_SESSION}
133 privilege asserted and is trying to send a signal to a
134 process with a different session ID, even though the effec‐
135 tive user ID matches the real or saved ID of the receiving
136 process.
137
138
139 ESRCH No process can be found corresponding to that specified by id
140 and idtype.
141
142
143
144 The sigsendset() function will fail if:
145
146 EFAULT The psp argument points to an illegal address.
147
148
150 kill(1), getpid(2), kill(2), priocntl(2), signal(3C), signal.h(3HEAD),
151 process(4), privileges(5)
152
153
154
155SunOS 5.11 19 Jul 2004 sigsend(2)