]> git.ipfire.org Git - thirdparty/man-pages.git/blob - man3/killpg.3
fd5284c1deefdf190b013cf44efb875e7119820d
[thirdparty/man-pages.git] / man3 / killpg.3
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 <faith@cs.unc.edu>
9 .\" Modified Tue Oct 22 08:11:14 EDT 1996 by Eric S. Raymond <esr@thyrsus.com>
10 .\" Modified 2004-06-16 by Michael Kerrisk <mtk.manpages@gmail.com>
11 .\" Added notes on CAP_KILL
12 .\" Modified 2004-06-21 by aeb
13 .\"
14 .TH KILLPG 3 2021-03-22 "Linux man-pages (unreleased)" "Linux Programmer's Manual"
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 .PP
24 .BI "int killpg(int " pgrp ", int " sig );
25 .fi
26 .PP
27 .RS -4
28 Feature Test Macro Requirements for glibc (see
29 .BR feature_test_macros (7)):
30 .RE
31 .PP
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 .PP
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 .PP
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 STANDARDS
85 POSIX.1-2001, POSIX.1-2008, SVr4, 4.4BSD
86 .RB ( killpg ()
87 first appeared in 4BSD).
88 .SH NOTES
89 There are various differences between the permission checking
90 in BSD-type systems and System\ V-type systems.
91 See the POSIX rationale for
92 .BR kill (3p).
93 A difference not mentioned by POSIX concerns the return
94 value
95 .BR EPERM :
96 BSD documents that no signal is sent and
97 .B EPERM
98 returned when the permission check failed for at least one target process,
99 while POSIX documents
100 .B EPERM
101 only when the permission check failed for all target processes.
102 .SS C library/kernel differences
103 On Linux,
104 .BR killpg ()
105 is implemented as a library function that makes the call
106 .IR "kill(\-pgrp,\ sig)" .
107 .SH SEE ALSO
108 .BR getpgrp (2),
109 .BR kill (2),
110 .BR signal (2),
111 .BR capabilities (7),
112 .BR credentials (7)