| Skip Navigation Links | |
| Exit Print View | |
![]() | man pages section 2: System Calls Oracle Solaris 11 Information Library |
- send a signal to a process or a group of processes
#include <signal.h>intsigsend(idtype_tidtype,id_tid,intsig);
intsigsendset(procset_t *psp,intsig);
Thesigsend() function sends a signal to the process or group ofprocesses specified byid andidtype. The signal to be sent isspecified bysig and is either 0 or one of thevalues listed insignal.h(3HEAD). Ifsig is 0 (the null signal), errorchecking is performed but no signal is actually sent. This valuecan be used to check the validity ofid andidtype.
The real or effective user ID of the sending process must matchthe real or saved user ID of the receiving process, unless the{PRIV_PROC_OWNER} privilege is asserted in the effective set of the sending processorsig isSIGCONT and the sending process has the samesession ID as the receiving process.
Ifidtype isP_PID,sig is sent to the process withprocess IDid.
Ifidtype isP_PGID,sig is sent to all processes withprocess group IDid.
Ifidtype isP_SID,sig is sent to all processes withsession IDid.
Ifidtype isP_TASKID,sig is sent to all processes withtask IDid.
Ifidtype isP_UID,sig is sent to any process witheffective user IDid.
Ifidtype isP_GID,sig is sent to any process witheffective group IDid.
Ifidtype isP_PROJID,sig is sent to any process withproject IDid.
Ifidtype isP_CID,sig is sent to any process with scheduler class IDid (seepriocntl(2)).
Ifidtype isP_CTID,sig is sent to any process withprocess contract IDid.
Ifidtype isP_ALL,sig is sent to all processes andid is ignored.
Ifid isP_MYID, the value ofid is taken fromthe calling process.
The process with a process ID of 0 is always excluded. The process with a process ID of 1 is excluded unlessidtypeis equal toP_PID.
Thesigsendset() function provides an alternate interface for sending signals to setsof processes. This function sends signals to the set of processes specifiedbypsp.psp is a pointer to a structure of typeprocset_t, definedin <sys/procset.h>, which includes the following members:
idop_t p_op;idtype_t p_lidtype;id_t p_lid;idtype_t p_ridtype;id_t p_rid;
Thep_lidtype andp_lid members specify the ID type and ID ofone (“left”) set of processes; thep_ridtype andp_rid members specify theID type and ID of a second (“right”) set of processes. IDtypes and IDs are specified just as for theidtype andidarguments tosigsend(). Thep_op member specifies the operation to be performed onthe two sets of processes to get the set of processes thefunction is to apply to. The valid values forp_op and theprocesses they specify are:
Set difference: processes in left set and not in right set.
Set intersection: processes in both left and right sets.
Set union: processes in either left or right set or both.
Set exclusive-or: processes in left or right set but not in both.
Upon successful completion,0 is return. Otherwise,-1 is returned anderrno is set to indicate the error.
Thesigsend() andsigsendset() functions will fail if:
Thesig argument is not a valid signal number, or theidtype argument is not a valid idtype field.
Thesig argument isSIGKILL,idtype isP_PID andid is1 (proc1).
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 {PRIV_PROC_OWNER} privilege asserted in the effective set, and the calling process is not sendingSIGCONT to a process that shares the same session ID.
The calling process does not have the {PRIV_PROC_SESSION} 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.
No process can be found corresponding to that specified byid andidtype.
Thesigsendset() function will fail if:
Thepsp argument points to an illegal address.
kill(1),getpid(2),kill(2),priocntl(2),signal(3C),signal.h(3HEAD),process(4),privileges(5)
Copyright © 2011, Oracle and/or its affiliates. All rights reserved.Legal Notices | ![]() ![]() |