]> git.ipfire.org Git - thirdparty/man-pages.git/blame - man2/killpg.2
Added/updated glibc feature test macro requirements
[thirdparty/man-pages.git] / man2 / killpg.2
CommitLineData
fea681da
MK
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>
305a0578 36.\" Modified 2004-06-16 by Michael Kerrisk <mtk-manpages@gmx.net>
fea681da 37.\" Added notes on CAP_KILL
c13182ef 38.\" Modified 2004-06-21 by aeb
fea681da 39.\"
cc4615cc 40.TH KILLPG 2 2007-07-26 "Linux" "Linux Programmer's Manual"
fea681da
MK
41.SH NAME
42killpg \- send signal to a process group
43.SH SYNOPSIS
44.B #include <signal.h>
45.sp
46.BI "int killpg(int " pgrp ", int " sig );
cc4615cc
MK
47.sp
48.in -4n
49Feature Test Macro Requirements for glibc (see
50.BR feature_test_macros (7)):
51.in
52.sp
53.BR killpg ():
54_BSD_SOURCE || _XOPEN_SOURCE\ >=\ 500
fea681da 55.SH DESCRIPTION
7145b9a9 56.BR killpg ()
fea681da
MK
57sends the signal
58.I sig
59to the process group
60.IR pgrp .
61See
62.BR signal (7)
63for a list of signals.
7dbfafa8 64
fea681da
MK
65If
66.I pgrp
67is 0,
e511ffb6 68.BR killpg ()
7dbfafa8 69sends the signal to the calling process's process group.
fea681da
MK
70(POSIX says: If
71.I pgrp
d9bfdb9c 72is less than or equal to 1, the behavior is undefined.)
fea681da
MK
73
74For a process to have permission to send a signal
75it must either be privileged (under Linux: have the
76.B CAP_KILL
77capability), or the real or effective
78user ID of the sending process must equal the real or
79saved set-user-ID of the target process.
8bd58774
MK
80In the case of
81.B SIGCONT
82it suffices when the sending and receiving
fea681da
MK
83processes belong to the same session.
84.SH "RETURN VALUE"
c13182ef
MK
85On success, zero is returned.
86On error, \-1 is returned, and
fea681da
MK
87.I errno
88is set appropriately.
89.SH ERRORS
90.TP
91.B EINVAL
92.I Sig
93is not a valid signal number.
94.TP
95.B EPERM
96The process does not have permission to send the signal
97to any of the target processes.
98.TP
99.B ESRCH
100No process can be found in the process group specified by
101.IR pgrp .
102.TP
103.B ESRCH
104The process group was given as 0 but the sending process does not
105have a process group.
a1d5f77c 106.SH "CONFORMING TO"
7dbfafa8 107SVr4, 4.4BSD (the
a1d5f77c
MK
108.BR killpg ()
109function call first appeared in 4BSD), POSIX.1-2001.
fea681da
MK
110.SH NOTES
111There are various differences between the permission checking
c13182ef 112in BSD-type systems and System V-type systems.
0bfa087b 113See the POSIX rationale for
7dbfafa8 114.BR kill ().
b5cc2ffb 115A difference not mentioned by POSIX concerns the return
682edefb
MK
116value
117.BR EPERM :
118BSD documents that no signal is sent and
119.BR EPERM
120returned when the permission check failed for at least one target process,
121while POSIX documents
122.B EPERM
123only when the permission check failed for all target processes.
4a6515ef
MK
124
125On Linux,
126.BR killpg ()
127is implemented as a library function that makes the call
128.IR "kill(-pgrp,\ sig)" .
fea681da
MK
129.SH "SEE ALSO"
130.BR getpgrp (2),
131.BR kill (2),
132.BR signal (2),
53a1443c
MK
133.BR capabilities (7),
134.BR credentials (7)