Debian Codegraph @

upstream/debian-unstable/man3/killpg.3

raw
1 .\" Copyright 1980-1991, Regents of the University of California.
2 .\" Copyright, the authors of the Linux man-pages project
3 .\"
4 .\" SPDX-License-Identifier: BSD-4-Clause-UC
5 .\"
6 .TH killpg 3 2025-05-17 "Linux man-pages 6.18"
7 .SH NAME
8 killpg \- send signal to a process group
9 .SH LIBRARY
10 Standard C library
11 .RI ( libc ,\~ \-lc )
12 .SH SYNOPSIS
13 .nf
14 .B #include <signal.h>
15 .P
16 .BI "int killpg(int " pgrp ", int " sig );
17 .fi
18 .P
19 .RS -4
20 Feature Test Macro Requirements for glibc (see
21 .BR feature_test_macros (7)):
22 .RE
23 .P
24 .BR killpg ():
25 .nf
26 _XOPEN_SOURCE >= 500
27 .\" || _XOPEN_SOURCE && _XOPEN_SOURCE_EXTENDED
28 || /* Since glibc 2.19: */ _DEFAULT_SOURCE
29 || /* glibc <= 2.19: */ _BSD_SOURCE
30 .fi
31 .SH DESCRIPTION
32 .BR killpg ()
33 sends the signal
34 .I sig
35 to the process group
36 .IR pgrp .
37 See
38 .BR signal (7)
39 for a list of signals.
40 .P
41 If
42 .I pgrp
43 is 0,
44 .BR killpg ()
45 sends the signal to the calling process's process group.
46 (POSIX says: if
47 .I pgrp
48 is less than or equal to 1, the behavior is undefined.)
49 .P
50 For the permissions required to send a signal to another process, see
51 .BR kill (2).
52 .SH RETURN VALUE
53 On success, zero is returned.
54 On error, \-1 is returned, and
55 .I errno
56 is set to indicate the error.
57 .SH ERRORS
58 .TP
59 .B EINVAL
60 .I sig
61 is not a valid signal number.
62 .TP
63 .B EPERM
64 The process does not have permission to send the signal
65 to any of the target processes.
66 For the required permissions, see
67 .BR kill (2).
68 .TP
69 .B ESRCH
70 No process can be found in the process group specified by
71 .IR pgrp .
72 .TP
73 .B ESRCH
74 The process group was given as 0 but the sending process does not
75 have a process group.
76 .SH VERSIONS
77 There are various differences between the permission checking
78 in BSD-type systems and System\ V-type systems.
79 See the POSIX rationale for
80 .BR kill (3p).
81 A difference not mentioned by POSIX concerns the return
82 value
83 .BR EPERM :
84 BSD documents that no signal is sent and
85 .B EPERM
86 returned when the permission check failed for at least one target process,
87 while POSIX documents
88 .B EPERM
89 only when the permission check failed for all target processes.
90 .SS C library/kernel differences
91 On Linux,
92 .BR killpg ()
93 is implemented as a library function that makes the call
94 .IR "kill(\-pgrp,\ sig)" .
95 .SH STANDARDS
96 POSIX.1-2008.
97 .SH HISTORY
98 POSIX.1-2001, SVr4, 4.4BSD
99 (first appeared in 4BSD).
100 .SH SEE ALSO
101 .BR getpgrp (2),
102 .BR kill (2),
103 .BR signal (2),
104 .BR capabilities (7),
105 .BR credentials (7)