| KILL(2) | Linux Programmer's Manual | KILL(2) |
NAME
kill - send signal to a process
SYNOPSIS
#include <sys/types.h>
#include <signal.h>
int kill(pid_t pid, int sig);
DESCRIPTION
The kill system call can be used to send any signal to any process group or process.
If pid is positive, then signal sig is sent to pid.
If pid equals 0, then sig is sent to every process in the process group of the current process.
If pid equals -1, then sig is sent to every process for which the calling process has permission to send signals, except for process 1 (init), but see below.
If pid is less than -1, then sig is sent to every process in the process group -pid.
If sig is 0, then no signal is sent, but error checking is still performed.
For a process to have permission to send a signal it must either be privileged (under Linux: have the CAP_KILL capability), or the real or effective user ID of the sending process must equal the real or saved set-user-ID of the target process. In the case of SIGCONT it suffices when the sending and receiving processes belong to the same session.
RETURN VALUE
On success (at least one signal was sent), zero is returned. On error, -1 is returned, and errno is set appropriately.
ERRORS
- EINVAL
- An invalid signal was specified.
- EPERM
- The process does not have permission to send the signal to any of the target processes.
- ESRCH
- The pid or process group does not exist. Note that an existing process might be a zombie, a process which already committed termination, but has not yet been wait()ed for.
NOTES
The only signals that can be sent task number one, the init process, are those for which init has explicitly installed signal handlers. This is done to assure the system is not brought down accidentally.
POSIX 1003.1-2001 requires that kill(-1,sig) send sig to all processes that the current process may send signals to, except possibly for some implementation-defined system processes. Linux allows a process to signal itself, but on Linux the call kill(-1,sig) does not signal the current process.
POSIX 1003.1-2003 requires that if a process sends a signal to itself, and that process does not have the signal blocked, and no other thread has it unblocked or is waiting for it in sigwait(), at least one unblocked signal must be delivered to the sending thread before the call of kill() returns.
LINUX HISTORY
Across different kernel versions, Linux has enforced different rules for the permissions required for an unprivileged process to send a signal to another process. In kernels 1.0 to 1.2.2, a signal could be sent if the effective user ID of the sender matched that of the receiver, or the real user ID of the sender matched that of the receiver. From kernel 1.2.3 until 1.3.77, a signal could be sent if the effective user ID of the sender matched either the real or effective user ID of the receiver. The current rules, which conform to POSIX 1003.1-2001, were adopted in kernel 1.3.78.
CONFORMING TO
SVr4, SVID, POSIX.1, X/OPEN, BSD 4.3, POSIX 1003.1-2001
SEE ALSO
_exit(2), killpg(2), signal(2), sigqueue(2), tkill(2), exit(3), capabilities(7), signal(7)
| 2004-06-24 | Linux 2.6.7 |
Different Versions of this Page:
- Version 6.17 (latest)
- Version 6.16
- Version 6.15
- Version 6.14
- Version 6.13
- Version 6.12
- Version 6.11
- Version 6.10
- Version 6.9.1
- Version 6.9
- Version 6.8
- Version 6.7
- Version 6.06
- Version 6.05.01
- Version 6.05
- Version 6.04
- Version 6.03
- Version 6.02
- Version 6.01
- Version 6.00
- Version 5.13
- Version 5.12
- Version 5.11
- Version 5.10
- Version 5.09
- Version 5.08
- Version 5.07
- Version 5.06
- Version 5.05
- Version 5.04
- Version 5.03
- Version 5.02
- Version 5.01
- Version 5.00
- Version 4.16
- Version 4.15
- Version 4.14
- Version 4.13
- Version 4.12
- Version 4.10
- Version 4.09
- Version 4.08
- Version 4.07
- Version 4.06
- Version 4.05
- Version 4.04
- Version 4.03
- Version 4.02
- Version 4.01
- Version 4.00
- Version 3.83
- Version 3.82
- Version 3.81
- Version 3.80
- Version 3.79
- Version 3.78
- Version 3.77
- Version 3.76
- Version 3.75
- Version 3.74
- Version 3.73
- Version 3.72
- Version 3.71
- Version 3.70
- Version 3.69
- Version 3.68
- Version 3.67
- Version 3.66
- Version 3.65
- Version 3.64
- Version 3.63
- Version 3.62
- Version 3.61
- Version 3.60
- Version 3.59
- Version 3.58
- Version 3.57
- Version 3.56
- Version 3.55
- Version 3.54
- Version 3.53
- Version 3.52
- Version 3.49
- Version 3.48
- Version 3.47
- Version 3.46
- Version 3.45
- Version 3.44
- Version 3.43
- Version 3.42
- Version 3.41
- Version 3.40
- Version 3.39
- Version 3.38
- Version 3.37
- Version 3.36
- Version 3.35
- Version 3.34
- Version 3.33
- Version 3.32
- Version 3.31
- Version 3.30
- Version 3.29
- Version 3.28
- Version 3.27
- Version 3.26
- Version 3.25
- Version 3.24
- Version 3.23
- Version 3.22
- Version 3.21
- Version 3.20
- Version 3.17
- Version 3.16
- Version 3.15
- Version 3.14
- Version 3.13
- Version 3.12
- Version 3.11
- Version 3.10
- Version 3.09
- Version 3.08
- Version 3.07
- Version 3.06
- Version 3.05
- Version 3.04
- Version 3.03
- Version 3.02
- Version 3.01
- Version 3.00
- Version 2.80
- Version 2.79
- Version 2.78
- Version 2.77
- Version 2.76
- Version 2.75
- Version 2.74
- Version 2.73
- Version 2.72
- Version 2.71
- Version 2.70
- Version 2.69
- Version 2.68
- Version 2.67
- Version 2.66
- Version 2.65
- Version 2.64
- Version 2.63
- Version 2.62
- Version 2.61
- Version 2.60
- Version 2.59
- Version 2.58
- Version 2.57
- Version 2.56
- Version 2.55
- Version 2.54
- Version 2.53
- Version 2.52
- Version 2.51
- Version 2.50
- Version 2.49
- Version 2.48
- Version 2.47
- Version 2.46
- Version 2.45
- Version 2.44
- Version 2.43
- Version 2.42
- Version 2.41
- Version 2.40
- Version 2.39
- Version 2.38
- Version 2.37
- Version 2.36
- Version 2.35
- Version 2.34
- Version 2.33
- Version 2.32
- Version 2.31
- Version 2.30
- Version 2.29
- Version 2.28
- Version 2.27
- Version 2.26
- Version 2.25
- Version 2.24
- Version 2.23
- Version 2.22
- Version 2.21
- Version 2.20
- Version 2.19
- Version 2.18
- Version 2.17
- Version 2.16
- Version 2.15
- Version 2.14
- Version 2.13
- Version 2.12
- Version 2.11
- Version 2.10
- Version 2.09
- Version 2.08
- Version 2.07
- Version 2.06
- Version 2.05
- Version 2.04
- Version 2.03
- Version 2.02
- Version 2.01
- Version 2.00