1killpg(3) Library Functions Manual killpg(3)
2
3
4
6 killpg - send signal to a process group
7
9 Standard C library (libc, -lc)
10
12 #include <signal.h>
13
14 int killpg(int pgrp, int sig);
15
16 Feature Test Macro Requirements for glibc (see feature_test_macros(7)):
17
18 killpg():
19 _XOPEN_SOURCE >= 500
20 || /* Since glibc 2.19: */ _DEFAULT_SOURCE
21 || /* glibc <= 2.19: */ _BSD_SOURCE
22
24 killpg() sends the signal sig to the process group pgrp. See signal(7)
25 for a list of signals.
26
27 If pgrp is 0, killpg() sends the signal to the calling process's
28 process group. (POSIX says: if pgrp is less than or equal to 1, the
29 behavior is undefined.)
30
31 For the permissions required to send a signal to another process, see
32 kill(2).
33
35 On success, zero is returned. On error, -1 is returned, and errno is
36 set to indicate the error.
37
39 EINVAL sig is not a valid signal number.
40
41 EPERM The process does not have permission to send the signal to any
42 of the target processes. For the required permissions, see
43 kill(2).
44
45 ESRCH No process can be found in the process group specified by pgrp.
46
47 ESRCH The process group was given as 0 but the sending process does
48 not have a process group.
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(3p). A difference not mentioned by POSIX concerns the return
54 value EPERM: BSD documents that no signal is sent and EPERM returned
55 when the permission check failed for at least one target process, while
56 POSIX documents EPERM only when the permission check failed for all
57 target processes.
58
59 C library/kernel differences
60 On Linux, killpg() is implemented as a library function that makes the
61 call kill(-pgrp, sig).
62
64 POSIX.1-2008.
65
67 POSIX.1-2001, SVr4, 4.4BSD (first appeared in 4BSD).
68
70 getpgrp(2), kill(2), signal(2), capabilities(7), credentials(7)
71
72
73
74Linux man-pages 6.04 2023-03-30 killpg(3)