]> git.ipfire.org Git - thirdparty/man-pages.git/blame - man3/killpg.3
All pages: Remove the 5th argument to .TH
[thirdparty/man-pages.git] / man3 / killpg.3
CommitLineData
fea681da
MK
1.\" Copyright (c) 1980, 1991 Regents of the University of California.
2.\" All rights reserved.
3.\"
47009d5e 4.\" SPDX-License-Identifier: BSD-4-Clause-UC
fea681da
MK
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>
c11b1abf 10.\" Modified 2004-06-16 by Michael Kerrisk <mtk.manpages@gmail.com>
fea681da 11.\" Added notes on CAP_KILL
c13182ef 12.\" Modified 2004-06-21 by aeb
fea681da 13.\"
45186a5d 14.TH KILLPG 3 2021-03-22 "Linux man-pages (unreleased)"
fea681da
MK
15.SH NAME
16killpg \- send signal to a process group
d27ce174
AC
17.SH LIBRARY
18Standard C library
8fc3b2cf 19.RI ( libc ", " \-lc )
fea681da 20.SH SYNOPSIS
c7db92b9 21.nf
fea681da 22.B #include <signal.h>
68e4db0a 23.PP
fea681da 24.BI "int killpg(int " pgrp ", int " sig );
c7db92b9 25.fi
68e4db0a 26.PP
d39ad78f 27.RS -4
cc4615cc
MK
28Feature Test Macro Requirements for glibc (see
29.BR feature_test_macros (7)):
d39ad78f 30.RE
9d2adbae 31.PP
cc4615cc 32.BR killpg ():
9d2adbae 33.nf
5c10d2c5
MK
34 _XOPEN_SOURCE >= 500
35.\" || _XOPEN_SOURCE && _XOPEN_SOURCE_EXTENDED
9d2adbae
MK
36 || /* Since glibc 2.19: */ _DEFAULT_SOURCE
37 || /* Glibc <= 2.19: */ _BSD_SOURCE
38.fi
fea681da 39.SH DESCRIPTION
7145b9a9 40.BR killpg ()
fea681da
MK
41sends the signal
42.I sig
43to the process group
44.IR pgrp .
45See
46.BR signal (7)
47for a list of signals.
847e0d88 48.PP
fea681da
MK
49If
50.I pgrp
51is 0,
e511ffb6 52.BR killpg ()
7dbfafa8 53sends the signal to the calling process's process group.
f64cc745 54(POSIX says: if
fea681da 55.I pgrp
d9bfdb9c 56is less than or equal to 1, the behavior is undefined.)
847e0d88 57.PP
6fee0ca3
MK
58For the permissions required to send a signal to another process, see
59.BR kill (2).
47297adb 60.SH RETURN VALUE
c13182ef
MK
61On success, zero is returned.
62On error, \-1 is returned, and
fea681da 63.I errno
f6a4078b 64is set to indicate the error.
fea681da
MK
65.SH ERRORS
66.TP
67.B EINVAL
d1ac81cf 68.I sig
fea681da
MK
69is not a valid signal number.
70.TP
71.B EPERM
72The process does not have permission to send the signal
73to any of the target processes.
6fee0ca3
MK
74For the required permissions, see
75.BR kill (2).
fea681da
MK
76.TP
77.B ESRCH
78No process can be found in the process group specified by
79.IR pgrp .
80.TP
81.B ESRCH
82The process group was given as 0 but the sending process does not
83have a process group.
3113c7f3 84.SH STANDARDS
618364ad 85POSIX.1-2001, POSIX.1-2008, SVr4, 4.4BSD
8f6c9a5e 86.RB ( killpg ()
618364ad 87first appeared in 4BSD).
fea681da
MK
88.SH NOTES
89There are various differences between the permission checking
efbfd7ec 90in BSD-type systems and System\ V-type systems.
0bfa087b 91See the POSIX rationale for
e3a78ee9 92.BR kill (3p).
b5cc2ffb 93A difference not mentioned by POSIX concerns the return
682edefb
MK
94value
95.BR EPERM :
96BSD documents that no signal is sent and
0daa9e92 97.B EPERM
682edefb
MK
98returned when the permission check failed for at least one target process,
99while POSIX documents
100.B EPERM
101only when the permission check failed for all target processes.
0722a578 102.SS C library/kernel differences
4a6515ef
MK
103On Linux,
104.BR killpg ()
105is implemented as a library function that makes the call
cd415e73 106.IR "kill(\-pgrp,\ sig)" .
47297adb 107.SH SEE ALSO
fea681da
MK
108.BR getpgrp (2),
109.BR kill (2),
110.BR signal (2),
53a1443c
MK
111.BR capabilities (7),
112.BR credentials (7)