OSDN Git Service

Import translated manuals from JM CVS Repository.
[linuxjm/jm.git] / manual / LDP_man-pages / original / 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@gmail.com>
37 .\"     Added notes on CAP_KILL
38 .\" Modified 2004-06-21 by aeb
39 .\"
40 .TH KILLPG 2 2007-07-26 "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 .sp
48 .in -4n
49 Feature 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
55 .SH DESCRIPTION
56 .BR killpg ()
57 sends the signal
58 .I sig
59 to the process group
60 .IR pgrp .
61 See
62 .BR signal (7)
63 for a list of signals.
64
65 If
66 .I pgrp
67 is 0,
68 .BR killpg ()
69 sends the signal to the calling process's process group.
70 (POSIX says: If
71 .I pgrp
72 is less than or equal to 1, the behavior is undefined.)
73
74 For a process to have permission to send a signal
75 it must either be privileged (under Linux: have the
76 .B CAP_KILL
77 capability), or the real or effective
78 user ID of the sending process must equal the real or
79 saved set-user-ID of the target process.
80 In the case of
81 .B SIGCONT
82 it suffices when the sending and receiving
83 processes belong to the same session.
84 .SH "RETURN VALUE"
85 On success, zero is returned.
86 On error, \-1 is returned, and
87 .I errno
88 is set appropriately.
89 .SH ERRORS
90 .TP
91 .B EINVAL
92 .I Sig
93 is not a valid signal number.
94 .TP
95 .B EPERM
96 The process does not have permission to send the signal
97 to any of the target processes.
98 .TP
99 .B ESRCH
100 No process can be found in the process group specified by
101 .IR pgrp .
102 .TP
103 .B ESRCH
104 The process group was given as 0 but the sending process does not
105 have a process group.
106 .SH "CONFORMING TO"
107 SVr4, 4.4BSD (the
108 .BR killpg ()
109 function call first appeared in 4BSD), POSIX.1-2001.
110 .SH NOTES
111 There are various differences between the permission checking
112 in BSD-type systems and System V-type systems.
113 See the POSIX rationale for
114 .BR kill ().
115 A difference not mentioned by POSIX concerns the return
116 value
117 .BR EPERM :
118 BSD documents that no signal is sent and
119 .B EPERM
120 returned when the permission check failed for at least one target process,
121 while POSIX documents
122 .B EPERM
123 only when the permission check failed for all target processes.
124
125 On Linux,
126 .BR killpg ()
127 is implemented as a library function that makes the call
128 .IR "kill(-pgrp,\ sig)" .
129 .SH "SEE ALSO"
130 .BR getpgrp (2),
131 .BR kill (2),
132 .BR signal (2),
133 .BR capabilities (7),
134 .BR credentials (7)