KILL(2)

NAME
kill - kill a process.

SYNOPSIS
#include <unistd.h>
int kill (int pid, int sig) ;

DESCRIPTION
kill() can be used to send any signal to any process group or process. Normally, signal SIGKILL or 9 is used, or SIGHUP.

If pid is positive, then signal sig is sent to pid. In this case, 0 is returned on success, or the error condition from send_sig() is returned.

If pid = -1, then sig is sent to every process except for the first one, from higher numbers in the proc table to lower. In this case, 0 is returned on success, or the last error condition from send_sig() is returned.

If pid < -1, then sif is sent to every process in the process group -pid. In this case, the number of processes the signal was sent to is returned, or a negative value for failure.

ERRORS
-EINVAL is returned if an invalid signal is sent.

-ESRCH is returned if the pid or process group does not exist.

-EPERM is returned if euid of the process calling kill() is not equal to euid of pid, unless the superuser called kill().

FILES
linux/kernel/exit.c
/usr/include/linux/sys.h
/usr/include/unistd.h

SEE ALSO
_exit(2), exit(3), signal(2)