kill(2)
NAME
kill − send signal to a process
SYNTAX
int kill(pid, sig)
int pid, sig;
DESCRIPTION
The kill system call sends the signal sig to the process specified by the process number in r0. For a list of signals, see signal(2).
•If sig is 0 (null signal), error checking is performed but no signal is actually sent. This can be used to check the validity of pid.
•If the process number is 0, the signal is sent to all other processes in the sender’s process group. For further information, see tty(4).
•If pid is -1 and the effective user ID of the sender is not superuser, 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 the process number is −1, and the user is the superuser, the signal is broadcast universally except to processes 0 and 1, the scheduler and initialization processes. For further information, see init(8).
•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.
Processes may send signals to themselves.
RESTRICTIONS
The sending and receiving processes must have the same effective user ID, otherwise this call is restricted to the superuser.
RETURN VALUE
If unsuccessful, returns a −1, and the global variable errno indicates the error code.
DIAGNOSTICS
The kill call will fail if:
[EINVAL] The sig argument is not a valid signal number.
[EINVAL] Attempt was made to send to an unassigned process group.
[ESRCH] No process can be found corresponding to that specified by pid.
[ESRCH] No processes killed.
[EPERM] The user ID of the sending process is not superuser, and its real or effective user ID does not match the real or effective user ID of the receiving process.
SEE ALSO
kill(1), getpid(2), setpgrp(2j), setpgrp(2v), signal(2)
ASSEMBLER
(kill = 37.)
(process number in r0)
sys kill; sig