KILL(2-POSIX) RISC/os Reference Manual KILL(2-POSIX)
NAME
kill - send a signal to a process or a group of processes
SYNOPSIS
#include <sys/types.h>
#include <signal.h>
int kill (pid, sig)
pidt pid;
int sig;
DESCRIPTION
kill sends a signal to a process or a group of processes.
The process or group of processes to which the signal is to
be sent is specified by pid. The signal that is to be sent
is specified by sig and is either one from the list given in
<signal.h> or 0. If sig is 0 (the null signal), error
checking is performed but no signal is actually sent. This
can be used to check the validity of pid.
For a process to have permission to send a signal to the
process designated by pid, the real or saved set-user-ID of
the sending process must match the real or effective user ID
of the receiving process, unless the process is the
superuser.
The processes with a process ID of 0 and a process ID of 1
are special processes [see intro(2)] and will be referred to
below as proc0 and proc1, respectively.
If pid is greater than zero, sig will be sent to the process
whose process ID is equal to pid. pid may equal 1.
If pid is 0, sig will be sent to all processes excluding
proc0 and proc1 whose process group ID is equal to the pro-
cess group ID of the sender, and for which the process has
permission to send a signal.
If pid is -1 and the effective user ID of the sender is not
super-user, sig will be sent to all processes excluding
proc0 and proc1 whose real user ID is equal to the effective
user ID of the sender.
If pid is -1 and the effective user ID of the sender is
super-user, sig will be sent to all processes excluding
proc0 and proc1.
If pid is negative but not -1, sig will be sent to all
processes whose process group ID is equal to the absolute
value of pid, and for which the process has permission to
send a signal.
Printed 1/15/91 Page 1
KILL(2-POSIX) RISC/os Reference Manual KILL(2-POSIX)
If the value of pid causes sig to be generated for the send-
ing process, and if sig is not blocked, either sig or at
least one pending unblocked signal is delivered to the send-
ing process before kill returns.
If sig is SIGCONT, the user ID checks are not applied when
SIGCONT is being sent to a process that is a member of the
same session as the sending process.
ERRORS
kill will fail and no signal will be sent if one or more of
the following are true:
[EINVAL] sig is not a valid signal number.
[EINVAL] sig is SIGKILL and pid is 1 (proc1).
[ESRCH] No process or process group can be found
corresponding to that specified by pid.
[EPERM] The process does not have permission to
send the signal to any process.
SEE ALSO
getpid(2), setsid(2), signal(2), sigaction(2).
DIAGNOSTICS
Upon successful completion, a value of 0 is returned. Oth-
erwise, a value of -1 is returned and errno is set to indi-
cate the error.
Page 2 Printed 1/15/91