]> git.ipfire.org Git - thirdparty/man-pages.git/blob - man2/killpg.2
Reordered sections to be more consistent, in some cases renaming
[thirdparty/man-pages.git] / man2 / killpg.2
1 .\" Copyright (c) 1980, 1991 Regents of the University of California.
2 .\" All rights reserved.
3 .\"
4 .\" Redistribution and use in source and binary forms, with or without
5 .\" modification, are permitted provided that the following conditions
6 .\" are met:
7 .\" 1. Redistributions of source code must retain the above copyright
8 .\" notice, this list of conditions and the following disclaimer.
9 .\" 2. Redistributions in binary form must reproduce the above copyright
10 .\" notice, this list of conditions and the following disclaimer in the
11 .\" documentation and/or other materials provided with the distribution.
12 .\" 3. All advertising materials mentioning features or use of this software
13 .\" must display the following acknowledgement:
14 .\" This product includes software developed by the University of
15 .\" California, Berkeley and its contributors.
16 .\" 4. Neither the name of the University nor the names of its contributors
17 .\" may be used to endorse or promote products derived from this software
18 .\" without specific prior written permission.
19 .\"
20 .\" THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
21 .\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
22 .\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
23 .\" ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
24 .\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
25 .\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
26 .\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
27 .\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
28 .\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
29 .\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
30 .\" SUCH DAMAGE.
31 .\"
32 .\" @(#)killpg.2 6.5 (Berkeley) 3/10/91
33 .\"
34 .\" Modified Fri Jul 23 21:55:01 1993 by Rik Faith <faith@cs.unc.edu>
35 .\" Modified Tue Oct 22 08:11:14 EDT 1996 by Eric S. Raymond <esr@thyrsus.com>
36 .\" Modified 2004-06-16 by Michael Kerrisk <mtk-manpages@gmx.net>
37 .\" Added notes on CAP_KILL
38 .\" Modified 2004-06-21 by aeb
39 .\"
40 .TH KILLPG 2 2004-06-21 "Linux" "Linux Programmer's Manual"
41 .SH NAME
42 killpg \- send signal to a process group
43 .SH SYNOPSIS
44 .B #include <signal.h>
45 .sp
46 .BI "int killpg(int " pgrp ", int " sig );
47 .SH DESCRIPTION
48 .BR killpg ()
49 sends the signal
50 .I sig
51 to the process group
52 .IR pgrp .
53 See
54 .BR signal (7)
55 for a list of signals.
56 If
57 .I pgrp
58 is 0,
59 .BR killpg ()
60 sends the signal to the sending process's process group.
61
62 (POSIX says: If
63 .I pgrp
64 is less than or equal to 1, the behaviour is undefined.)
65
66 For a process to have permission to send a signal
67 it must either be privileged (under Linux: have the
68 .B CAP_KILL
69 capability), or the real or effective
70 user ID of the sending process must equal the real or
71 saved set-user-ID of the target process.
72 In the case of SIGCONT it suffices when the sending and receiving
73 processes belong to the same session.
74 .SH "RETURN VALUE"
75 On success, zero is returned.
76 On error, \-1 is returned, and
77 .I errno
78 is set appropriately.
79 .SH ERRORS
80 .TP
81 .B EINVAL
82 .I Sig
83 is not a valid signal number.
84 .TP
85 .B EPERM
86 The process does not have permission to send the signal
87 to any of the target processes.
88 .TP
89 .B ESRCH
90 No process can be found in the process group specified by
91 .IR pgrp .
92 .TP
93 .B ESRCH
94 The process group was given as 0 but the sending process does not
95 have a process group.
96 .SH "CONFORMING TO"
97 SVr4, 4.4BSD (The
98 .BR killpg ()
99 function call first appeared in 4BSD), POSIX.1-2001.
100 .SH NOTES
101 There are various differences between the permission checking
102 in BSD-type systems and System V-type systems.
103 See the POSIX rationale for
104 .BR kill (2).
105 A difference not mentioned by POSIX concerns the return
106 value EPERM: BSD documents that no signal is sent and EPERM returned
107 when the permission check failed for at least one target process,
108 while POSIX documents EPERM only when the permission check failed
109 for all target processes.
110 .SH "SEE ALSO"
111 .BR getpgrp (2),
112 .BR kill (2),
113 .BR signal (2),
114 .BR capabilities (7)