1KILLPG(2) Linux Programmer's Manual KILLPG(2)
2
3
4
6 killpg - send signal to a process group
7
9 #include <signal.h>
10
11 int killpg(int pgrp, int sig);
12
13 Feature Test Macro Requirements for glibc (see feature_test_macros(7)):
14
15 killpg(): _BSD_SOURCE || _XOPEN_SOURCE >= 500
16
18 killpg() sends the signal sig to the process group pgrp. See signal(7)
19 for a list of signals.
20
21 If pgrp is 0, killpg() sends the signal to the calling process's
22 process group. (POSIX says: If pgrp is less than or equal to 1, the
23 behavior is undefined.)
24
25 For a process to have permission to send a signal it must either be
26 privileged (under Linux: have the CAP_KILL capability), or the real or
27 effective user ID of the sending process must equal the real or saved
28 set-user-ID of the target process. In the case of SIGCONT it suffices
29 when the sending and receiving processes belong to the same session.
30
32 On success, zero is returned. On error, -1 is returned, and errno is
33 set appropriately.
34
36 EINVAL Sig is not a valid signal number.
37
38 EPERM The process does not have permission to send the signal to any
39 of the target processes.
40
41 ESRCH No process can be found in the process group specified by pgrp.
42
43 ESRCH The process group was given as 0 but the sending process does
44 not have a process group.
45
47 SVr4, 4.4BSD (the killpg() function call first appeared in 4BSD),
48 POSIX.1-2001.
49
51 There are various differences between the permission checking in BSD-
52 type systems and System V-type systems. See the POSIX rationale for
53 kill(). A difference not mentioned by POSIX concerns the return value
54 EPERM: BSD documents that no signal is sent and EPERM returned when the
55 permission check failed for at least one target process, while POSIX
56 documents EPERM only when the permission check failed for all target
57 processes.
58
59 On Linux, killpg() is implemented as a library function that makes the
60 call kill(-pgrp, sig).
61
63 getpgrp(2), kill(2), signal(2), capabilities(7), credentials(7)
64
66 This page is part of release 3.25 of the Linux man-pages project. A
67 description of the project, and information about reporting bugs, can
68 be found at http://www.kernel.org/doc/man-pages/.
69
70
71
72Linux 2007-07-26 KILLPG(2)