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