KILLPG(2) Linux Programmer's Manual KILLPG(2)
NAME
killpg(2,3) - send(2,n) signal(2,7) to a process group
SYNOPSIS
#include <signal.h>
int killpg(2,3)(int pgrp, int sig);
DESCRIPTION
Killpg sends the signal(2,7) sig to the process group pgrp. See signal(2,7)(7)
for a list of signals. If pgrp is 0, killpg(2,3) sends the signal(2,7) to the
sending process's process group.
(POSIX says: If pgrp is less(1,3) than or equal to 1, the behaviour is unde-
fined.)
For a process to have permission to send(2,n) a signal(2,7) 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, zero is returned. On error(8,n), -1 is returned, and errno is
set(7,n,1 builtins) appropriately.
ERRORS
EINVAL Sig is not a valid signal(2,7) number.
EPERM The process does not have permission to send(2,n) the signal(2,7) to any
of the target processes.
ESRCH No process can be found in(1,8) the process group specified by pgrp.
ESRCH The process group was given as 0 but the sending process does
not have a process group.
NOTES
There are various differences between the permission checking in(1,8) BSD-
type systems and SYSV-type systems. See the POSIX rationale for kill(1,2,1 builtins)().
A difference not mentioned by POSIX concerns the return value EPERM:
BSD documents that no signal(2,7) is sent and EPERM returned when the per-
mission check failed for at least one target process, while POSIX docu-
ments EPERM only when the permission check failed for all target pro-
cesses.
CONFORMING TO
SVr4, 4.4BSD (The killpg(2,3) function call first appeared in(1,8) 4.0BSD).
SEE ALSO
getpgrp(2), kill(1,2,1 builtins)(2), signal(2,7)(2), capabilities(7)
BSD Man Page 2004-06-21 KILLPG(2)