Debian Codegraph @

upstream/debian-trixie/man3/killpg.3

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