'\" 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 \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)