OSDN Git Service

6f372de9314969516b921c9ff6a742699571cab4
[linuxjm/LDP_man-pages.git] / draft / 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 .\" Japanese Version Copyright (c) 1997 Kazuyuki Tanisako
41 .\"         all rights reserved.
42 .\" Translated Sat May 17 14:10:42 JST 1997
43 .\"         by Kazuyuki Tanisako <tanisako@osa.dec-j.co.jp>
44 .\" Updated & Modified Sat Feb  5 21:24:32 JST 2005
45 .\"         by Yuichi SATO <ysato444@yahoo.co.jp>
46 .\"
47 .\"WORD:        process group           プロセス・グループ
48 .\"WORD:        signal                  シグナル
49 .\"WORD:        effective user ID       実効ユーザーID
50 .\"WORD:        super-user              スーパー・ユーザー
51 .\"
52 .TH KILLPG 2 2010-09-20 "Linux" "Linux Programmer's Manual"
53 .\"O .SH NAME
54 .SH 名前
55 .\"O killpg \- send signal to a process group
56 killpg \- シグナルをプロセス・グループに送る
57 .\"O .SH SYNOPSIS
58 .SH 書式
59 .B #include <signal.h>
60 .sp
61 .BI "int killpg(int " pgrp ", int " sig );
62 .sp
63 .in -4n
64 .\"O Feature Test Macro Requirements for glibc (see
65 .\"O .BR feature_test_macros (7)):
66 glibc 向けの機能検査マクロの要件
67 .RB ( feature_test_macros (7)
68 参照):
69 .in
70 .sp
71 .ad l
72 .TP 4
73 .BR killpg ():
74 _BSD_SOURCE || _XOPEN_SOURCE\ >=\ 500 ||
75 _XOPEN_SOURCE\ &&\ _XOPEN_SOURCE_EXTENDED
76 .ad
77 .\"O .SH DESCRIPTION
78 .SH 説明
79 .\"O .BR killpg ()
80 .\"O sends the signal
81 .\"O .I sig
82 .\"O to the process group
83 .\"O .IR pgrp .
84 .BR killpg ()
85
86 .I sig
87 で指定したシグナルを
88 .I pgrp
89 で指定したプロセス・グループに送る。
90 シグナルの定義の一覧は
91 .\"O See
92 .\"O .BR signal (7)
93 .\"O for a list of signals.
94 .BR signal (7)
95 を参照のこと。
96
97 .\"O If
98 .\"O .I pgrp
99 .\"O is 0,
100 .\"O .BR killpg ()
101 .\"O sends the signal to the sending process's process group.
102 .\"O sends the signal to the calling process's process group.
103 引き数
104 .I pgrp
105 に 0 を指定した場合には
106 .BR killpg ()
107 は呼び出し元のプロセスが属しているプロセス・グループに対してシグナルを送る。
108 .\"O (POSIX says: If
109 .\"O .I pgrp
110 .\"O is less than or equal to 1, the behavior is undefined.)
111 (POSIX では以下のように記述されている:
112 .I pgrp
113 が 1 以下である場合、動作は未定義である。)
114
115 .\"O For a process to have permission to send a signal
116 .\"O it must either be privileged (under Linux: have the
117 .\"O .B CAP_KILL
118 .\"O capability), or the real or effective
119 .\"O user ID of the sending process must equal the real or
120 .\"O saved set-user-ID of the target process.
121 プロセスがシグナルを送信する許可を持つためには、
122 プロセスが特権 (Linux では
123 .B CAP_KILL
124 ケーパビリティ (capability)) を持つか、
125 送信元プロセスの実ユーザー ID または実効ユーザー ID が
126 送信先プロセスの実 set-user-ID または保存 set-user-ID と
127 等しくなければならない。
128 .\"O In the case of
129 .\"O .B SIGCONT
130 .\"O it suffices when the sending and receiving
131 .\"O processes belong to the same session.
132 .B SIGCONT
133 の場合、送信プロセスと受信プロセスが
134 同じセッションに属していれば十分である。
135 .\"O .SH "RETURN VALUE"
136 .SH 返り値
137 .\"O On success, zero is returned.
138 .\"O On error, \-1 is returned, and
139 .\"O .I errno
140 .\"O is set appropriately.
141 正常終了すると 0 が返り値となる。異常終了の場合 \-1 が返り値となり
142 .I errno
143 に原因コードが設定される。
144 .\"O .SH ERRORS
145 .SH エラー
146 .TP
147 .B EINVAL
148 .\"O .I Sig
149 .\"O is not a valid signal number.
150 .I sig
151 で指定された値は無効なシグナル番号である。
152 .TP
153 .B EPERM
154 .\"O The process does not have permission to send the signal
155 .\"O to any of the target processes.
156 プロセスに何れかの送信先プロセスにシグナルを送信する許可がない。
157 .TP
158 .B ESRCH
159 .\"O No process can be found in the process group specified by
160 .\"O .IR pgrp .
161 .I pgrp
162 で指定されたプロセス・グループに属するプロセスが存在しなかった。
163 .TP
164 .B ESRCH
165 .\"O The process group was given as 0 but the sending process does not
166 .\"O have a process group.
167 プロセス・グループとして 0 が指定されたが、送信プロセスは
168 プロセス・グループを持っていない。
169 .\"O .SH "CONFORMING TO"
170 .SH 準拠
171 .\"O SVr4, 4.4BSD (the
172 .\"O .BR killpg ()
173 .\"O function call first appeared in 4BSD), POSIX.1-2001.
174 SVr4, 4.4BSD
175 .RB ( killpg ()
176 は 4BSD で初めて追加された), POSIX.1-2001。
177 .\"O .SH NOTES
178 .SH 注意
179 .\"O There are various differences between the permission checking
180 .\"O in BSD-type systems and System V-type systems.
181 .\"O See the POSIX rationale for
182 .\"O .BR kill ().
183 .\"O A difference not mentioned by POSIX concerns the return
184 .\"O value
185 .\"O .BR EPERM :
186 .\"O BSD documents that no signal is sent and
187 .\"O .B EPERM
188 .\"O returned when the permission check failed for at least one target process,
189 .\"O while POSIX documents
190 .\"O .B EPERM
191 .\"O only when the permission check failed for all target processes.
192 BSD 系システムと System V 系システムでは、
193 許可のチェックに様々な違いがある。
194 .BR kill (2)
195 についての POSIX の原理 (rationale) を参照すること。
196 POSIX で記述されていない違いとしては、返り値
197 .B EPERM
198 がある。
199 BSD では「送信先プロセスの許可のチェックが 1 つでも失敗した場合は、
200 シグナルが送信されず、
201 .B EPERM
202 が返される」と記述されている。
203 POSIX では「送信先プロセスの許可のチェックが全て失敗した場合にのみ、
204 .B EPERM
205 が返される」と記述されている。
206
207 .\"O On Linux,
208 .\"O .BR killpg ()
209 .\"O is implemented as a library function that makes the call
210 .\"O .IR "kill(-pgrp,\ sig)" .
211 Linux では、
212 .BR killpg ()
213 はライブラリ関数として実装されており、
214 .I "kill(-pgrp,\ sig)"
215 の呼び出しが行われる。
216 .\"O .SH "SEE ALSO"
217 .SH 関連項目
218 .BR getpgrp (2),
219 .BR kill (2),
220 .BR signal (2),
221 .BR credentials (7),
222 .BR capabilities (7)