kill(2) System Calls Manual kill(2) kill - LIBRARY Standard C library (libc, -lc) #include int kill(pid_t pid, int sig); glibc (. feature_test_macros(7)): kill(): _POSIX_C_SOURCE kill() - - . pid , sig pid. pid 0, sig , . pid -1, sig , , 1 (init), . pid -1, sig , , ID -pid. sig 0, , ; ID . , ( Linux: CAP_KILL ), , . SIGCONT ( ; ; ). On success (at least one signal was sent), zero is returned. On error, -1 is returned, and errno is set to indicate the error. EINVAL . EPERM -. ESRCH - . , -- , , wait(2). POSIX.1-2008. POSIX.1-2001, SVr4, 4.3BSD. , Linux 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 Linux 1.0 to 1.2.2, a signal could be sent if the effective user ID of the sender matched effective user ID of the target, or the real user ID of the sender matched the real user ID of the target. From Linux 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 target. The current rules, which conform to POSIX.1, were adopted in Linux 1.3.78. init 1 , . , , - . POSIX.1 , kill(-1,sig) sig , , , . Linux , kill(-1,sig) . POSIX.1 , , , sigwait(3), , , kill(). In Linux 2.6 up to and including Linux 2.6.7, there was a bug that meant that when sending signals to a process group, kill() failed with the error EPERM if the caller did not have permission to send the signal to any (rather than all) of the members of the process group. Notwithstanding this error return, the signal was still delivered to all of the processes for which the caller had permission to signal. . kill(1), _exit(2), pidfd_send_signal(2), signal(2), tkill(2), exit(3), killpg(3), sigqueue(3), capabilities(7), credentials(7), signal(7) Alex Nik , Azamat Hackimov , Yuri Kozlov ; GNU 3 , . . , , . Linux man-pages 6.06 31 2023 . kill(2)