int send_signal(int pid, int signal);
This syscall sends the passed signal to the passed PID.
pid
can be one of four values:
Lesser than -1
: pid
is taken as a process group ID.
-1
: Signals are sent to any process that we can send to but init
(PID 1) or the caller process.
0
: Signals are sent to any process in the caller’s process group,
including the caller process.
Greater than 0
: pid
is taken as the PID to send to.
Only processes sharing the same UID or EUID as the caller’s EUID can be
signaled. The MAC_CAP_SIGNALALL
capability overrides this check.
If signal
is 0
, instead of a signal being sent, only the
permissions to send one are checked.
It returns 0
on success and -1
on failure, with the following
errno:
ESRCH
pid
is not a valid target for sending.
EPERM
The caller does not have permissions to signal pid
.
EINVAL
signal
is not a valid signal.