'\"macro stdmacro
.if n .pH g2.sigsend @(#)sigsend	40.17 of 10/10/89
.\" Copyright 1989 AT&T
.nr X
.if \nX=0 .ds x} sigsend 2 "" "\&"
.if \nX=1 .ds x} sigsend 2 ""
.if \nX=2 .ds x} sigsend 2 "" "\&"
.if \nX=3 .ds x} sigsend "" "" "\&"
.TH \*(x}
.SH NAME
\f4sigsend\f1, \f4sigsendset\f1 \- send a signal to a process or a group of processes
.SH SYNOPSIS
\f4#include <sys/types.h>\f1
.br
\f4#include <sys/signal.h>\f1
.br
\f4#include <sys/procset.h>\f1
.P
\f4int sigsend(idtype_t idtype, id_t id, int sig);\f1
.P
\f4int sigsendset(procset_t *psp, int sig);\f1
.SH DESCRIPTION
\f4sigsend\fP sends a signal to the process or group of processes specified
by \f2id\fP and \f2idtype\f1.
The signal to be sent is specified by \f2sig\f1 and is either zero
or one of the values listed in \f4signal\fP(5).
If \f2sig\f1 is zero (the null signal), error checking is performed but no signal is
actually sent.  This value can be used to check the validity of \f2id\fP and 
\f2idtype\f1.
.PP
The real or effective user \s-1ID\s+1 of the sending process must match the real or 
effective user \s-1ID\s+1 of the receiving process, unless the effective user \s-1ID\s+1 of
the sending process is super-user, or \f2sig\f1 is \f4SIGCONT\fP and the sending 
process has the same session \s-1ID\s+1 as the receiving process.
.PP
If \f2idtype\f1 is \f4P_PID\fP, \f2sig\f1 is sent to the process with process
\s-1ID\s+1 \f2id\fP.
.PP
If \f2idtype\f1 is \f4P_PGID\fP, \f2sig\f1 is sent to any process with process
group \s-1ID\s+1 \f2id\fP.
.PP
If \f2idtype\f1 is \f4P_SID\fP, \f2sig\f1 is sent to any process with session
\s-1ID\s+1 \f2id\fP.
.PP
If \f2idtype\f1 is \f4P_UID\fP, \f2sig\f1 is sent to any process with 
effective user \s-1ID\s+1 \f2id\fP.
.PP
If \f2idtype\f1 is \f4P_GID\fP, \f2sig\f1 is sent to any process with
effective group \s-1ID\s+1 \f2id\fP.
.PP
If \f2idtype\f1 is \f4P_CID\fP, \f2sig\f1 is sent to any process with 
scheduler class \s-1ID\s+1 \f2id\fP [see \f4priocntl\f1(2)].
.PP
If \f2idtype\f1 is \f4P_ALL\fP, \f2sig\f1 is sent to all processes and
\f2id\fP is ignored.
.PP
If \f2id\fP is \f4P_MYID\fP, the value of \f2id\f1 is taken from the calling
process.
.PP
The process with a process \s-1ID\s+1 of 0 is always excluded.  The process with a
process \s-1ID\s+1 of 1 is excluded unless \f2idtype\f1 is equal to \f4P_PID\fP.
.PP
\f4sigsendset\fP provides an alternate interface for sending signals to
sets of processes.
This function sends signals to the set of processes specified by \f2psp\fP.
\f2psp\f1 is a pointer to a structure of type \f4procset_t\f1, defined in
\f4sys/procset.h>\f1, which includes the following members:
.PP
.RS
.nf
.ft 4
idop_t       p_op;
idtype_t     p_lidtype;
id_t         p_lid;
idtype_t     p_ridtype;
id_t         p_rid;
.ft 1
.fi
.RE
.P
\f4p_lidtype\f1
and
\f4p_lid\f1
specify the \s-1ID\s0 type and \s-1ID\s0 of one (``left'') set of processes;
\f4p_ridtype\f1
and
\f4p_rid\f1
specify the \s-1ID\s0 type and \s-1ID\s0 of a second (``right'') set of processes.
\s-1ID\s0 types and \s-1ID\s0s are specified just as for the
.I idtype
and
.I id
arguments to
\f4sigsend\fP.
\f4p_op\f1
specifies the operation to be performed on the two sets of processes to get
the set of processes the system call is to apply to.
The valid values for
\f4p_op\f1
and the processes they specify are:
.TP 14n
\f4POP_DIFF\f1
set difference: processes in left set and not in right set
.TP
\f4POP_AND\f1
set intersection: processes in both left and right sets
.TP
\f4POP_OR\f1
set union: processes in either left or right set or both
.TP
\f4POP_XOR\f1
set exclusive-or: processes in left or right set but not in both
.PP
\f4sigsend\fP and \f4sigsendset\fP fail if one or more of the following are true:
.TP 15
\f4EINVAL\fP
\f2sig\f1 is not a valid signal number.
.TP
\f4EINVAL\fP
\f2idtype\f1 is not a valid idtype field.
.TP
\f4EINVAL\fP
\f2sig\f1 is \f4SIGKILL\fP, \f2idtype\f1 is \f4P_PID\fP and \f2id\fP is 1 (proc1).
.TP
\f4ESRCH\fP
No process can be found corresponding to that specified by \f2id\fP and
\f2idtype\f1.
.TP
\f4EPERM\fP
The user \s-1ID\s+1 of the sending process is not super-user, and its real or
effective user \s-1ID\s+1 does not match the real or effective user \s-1ID\s+1 of the
receiving process, and the calling process is not sending \f4SIGCONT\fP to a
process that shares the same session.
.PP
In addition, \f4sigsendset\fP fails if:
.TP 15
\f4EFAULT\fP
\f4psp\f1 points outside the process's allocated address space.
.SH SEE ALSO
\f4getpid\fP(2), \f4getpgrp\fP(2), \f4kill\fP(2), \f4priocntl\fP(2),
\f4setpid\fP(2), \f4signal\fP(2), \f4signal\fP(5).
.P
\f4kill\fP(1) in the \f2User's Reference Manual\f1.
.SH DIAGNOSTICS
On success, \f4sigsend\fP returns zero.
On failure, it returns \-1 and sets \f4errno\f1 to indicate the error.
.\"	@(#)sigsend.2	1 of 10/4/88
.Ee
