OSDN Git Service

(split) LDP: Update release pages based on LDP 3.54 release
[linuxjm/LDP_man-pages.git] / release / man2 / kill.2
1 .\" Copyright (c) 1992 Drew Eckhardt (drew@cs.colorado.edu), March 28, 1992
2 .\"
3 .\" %%%LICENSE_START(VERBATIM)
4 .\" Permission is granted to make and distribute verbatim copies of this
5 .\" manual provided the copyright notice and this permission notice are
6 .\" preserved on all copies.
7 .\"
8 .\" Permission is granted to copy and distribute modified versions of this
9 .\" manual under the conditions for verbatim copying, provided that the
10 .\" entire resulting derived work is distributed under the terms of a
11 .\" permission notice identical to this one.
12 .\"
13 .\" Since the Linux kernel and libraries are constantly changing, this
14 .\" manual page may be incorrect or out-of-date.  The author(s) assume no
15 .\" responsibility for errors or omissions, or for damages resulting from
16 .\" the use of the information contained herein.  The author(s) may not
17 .\" have taken the same level of care in the production of this manual,
18 .\" which is licensed free of charge, as they might when working
19 .\" professionally.
20 .\"
21 .\" Formatted or processed versions of this manual, if unaccompanied by
22 .\" the source, must acknowledge the copyright and authors of this work.
23 .\" %%%LICENSE_END
24 .\"
25 .\" Modified by Michael Haardt <michael@moria.de>
26 .\" Modified by Thomas Koenig <ig25@rz.uni-karlsruhe.de>
27 .\" Modified 1993-07-23 by Rik Faith <faith@cs.unc.edu>
28 .\" Modified 1993-07-25 by Rik Faith <faith@cs.unc.edu>
29 .\" Modified 1995-11-01 by Michael Haardt
30 .\"  <michael@cantor.informatik.rwth-aachen.de>
31 .\" Modified 1996-04-14 by Andries Brouwer <aeb@cwi.nl>
32 .\"  [added some polishing contributed by Mike Battersby <mib@deakin.edu.au>]
33 .\" Modified 1996-07-21 by Andries Brouwer <aeb@cwi.nl>
34 .\" Modified 1997-01-17 by Andries Brouwer <aeb@cwi.nl>
35 .\" Modified 2001-12-18 by Andries Brouwer <aeb@cwi.nl>
36 .\" Modified 2002-07-24 by Michael Kerrisk <mtk.manpages@gmail.com>
37 .\"     Added note on historical rules enforced when an unprivileged process
38 .\"     sends a signal.
39 .\" Modified 2004-06-16 by Michael Kerrisk <mtk.manpages@gmail.com>
40 .\"     Added note on CAP_KILL
41 .\" Modified 2004-06-24 by aeb
42 .\" Modified, 2004-11-30, after idea from emmanuel.colbus@ensimag.imag.fr
43 .\"
44 .\"*******************************************************************
45 .\"
46 .\" This file was generated with po4a. Translate the source file.
47 .\"
48 .\"*******************************************************************
49 .\"
50 .\" Japanese Version Copyright (c) 1997 Kazuyuki Tanisako
51 .\"         all rights reserved.
52 .\" Translated 1997-05-17, Kazuyuki Tanisako <tanisako@osa.dec-j.co.jp>
53 .\" Modified 1997-05-27, Kazuyuki Tanisako <tanisako@osa.dec-j.co.jp>
54 .\" Modified 1998-02-05, Kazuyuki Tanisako <tanisako@osa.dec-j.co.jp>
55 .\" Updated 2001-12-27, Kentaro Shirakata <argrath@ub32.org>
56 .\" Updated 2002-01-03, Kentaro Shirakata <argrath@ub32.org>
57 .\" Updated 2002-09-27, Kentaro Shirakata <argrath@ub32.org>
58 .\" Updated 2005-02-27, Akihiro MOTOKI <amotoki@dd.iij4u.or.jp>
59 .\" Updated 2005-12-05, Akihiro MOTOKI, Catch up to LDP man-pages 2.16
60 .\" Updated 2008-08-06, Akihiro MOTOKI, LDP v3.05
61 .\"
62 .TH KILL 2 2013\-09\-17 Linux "Linux Programmer's Manual"
63 .SH 名前
64 kill \- プロセスにシグナルを送る
65 .SH 書式
66 .nf
67 \fB#include <sys/types.h>\fP
68 .br
69 \fB#include <signal.h>\fP
70 .sp
71 \fBint kill(pid_t \fP\fIpid\fP\fB, int \fP\fIsig\fP\fB);\fP
72 .fi
73 .sp
74 .in -4n
75 glibc 向けの機能検査マクロの要件 (\fBfeature_test_macros\fP(7)  参照):
76 .in
77 .sp
78 .ad l
79 \fBkill\fP(): _POSIX_C_SOURCE\ >=\ 1 || _XOPEN_SOURCE || _POSIX_SOURCE
80 .ad b
81 .SH 説明
82 システムコールの \fBkill\fP()  は、任意のプロセス・グループもしくはプロセスにシグナルを 送るのに使われる。
83 .PP
84 \fIpid\fP に正の値を指定した場合、シグナル \fIsig\fP が \fIpid\fP で指定された ID を持つプロセスに送られる。
85 .PP
86 \fIpid\fP に 0 を指定した場合、 呼び出し元のプロセスのプロセス・グループに属するすべてのプロセスに \fIsig\fP で指定したシグナルが送られる。
87 .PP
88 \fIpid\fP に \-1 を指定した場合、 \fIsig\fP で指定したシグナルが、 呼び出し元のプロセスがシグナルを送る許可を持つ全てのプロセスに
89 送られる。但し、プロセス番号 1 (\fIinit\fP) へはシグナルは送られない。 以下の関連部分も参照のこと。
90 .PP
91 \fIpid\fP に \-1 より小さな値を指定した場合、 ID が \fI\-pid\fP のプロセス・グループに属するすべてのプロセスに \fIsig\fP
92 で指定したシグナルが送られる。
93 .PP
94 \fIsig\fP に 0 を指定した場合、シグナルは送られないが、 エラーのチェックは行われる。これを使って、プロセス ID や プロセスグループ ID
95 の存在確認を行うことができる。
96
97 For a process to have permission to send a signal it must either be
98 privileged (under Linux: have the \fBCAP_KILL\fP capability), or the real or
99 effective user ID of the sending process must equal the real or saved
100 set\-user\-ID of the target process.  In the case of \fBSIGCONT\fP it suffices
101 when the sending and receiving processes belong to the same session.
102 (Historically, the rules were different; see NOTES.)
103 .SH 返り値
104 成功した場合 (少なくとも一つのシグナルが送信された場合)、 0 が返される。エラーの場合 \-1 が返され、 \fIerrno\fP が適切に設定される。
105 .SH エラー
106 .TP 
107 \fBEINVAL\fP
108 無効なシグナルを指定した。
109 .TP 
110 \fBEPERM\fP
111 プロセスが、受信するプロセスのいずれに対しても シグナルを送る許可を持っていない。
112 .TP 
113 \fBESRCH\fP
114 指定したプロセスまたはプロセス・グループが存在しなかった。 ゾンビプロセスは存在するプロセスとしてみなされる。
115 ゾンビプロセスとはすでに処理は終了しているが、親プロセスによる \fBwait\fP()  処理が行われていないプロセスのことである。
116 .SH 準拠
117 SVr4, 4.3BSD, POSIX.1\-2001.
118 .SH 注意
119 プロセス番号 1 の \fIinit\fP プロセスに送ることができるシグナルは、 \fIinit\fP が明示的にシグナルハンドラを設定したシグナルだけである。
120 こうなっているのは、誤ってシステムをダウンさせないようにするためである。
121 .LP
122 POSIX.1\-2001 では、 \fIkill(\-1,sig)\fP が 呼び出し元のプロセスがシグナルを送ることが出来るプロセス全てに \fIsig\fP
123 を送ることを要求している。 但し、システム実装時に定められたシステムプロセスは シグナルの送信対象から除外される。 Linux
124 では、プロセスが自分自身にシグナルを送れるようになっているが、 Linux の \fIkill(\-1,sig)\fP
125 は呼び出し元のプロセスにはシグナルを送らない。
126 .LP
127 POSIX.1\-2001 では以下の動作になることを要求している。 自分自身にシグナルを送ると、シグナルを送ったスレッドがそのシグナルをブロック
128 しておらず、他のどのスレッドもそのシグナルを受ける状態にもなく \fBsigwait\fP(3)  でそのシグナルを待ってもいない場合、 \fBkill\fP()
129 が返る前に少なくとも一つのブロックされていない シグナルがシグナルを送ったスレッドに配送されなければならない。
130 .SS "Linux での注意"
131 .\" In the 0.* kernels things chopped and changed quite
132 .\" a bit - MTK, 24 Jul 02
133 Across different kernel versions, Linux has enforced different rules for the
134 permissions required for an unprivileged process to send a signal to another
135 process.  In kernels 1.0 to 1.2.2, a signal could be sent if the effective
136 user ID of the sender matched effective user ID of the target, or the real
137 user ID of the sender matched the real user ID of the target.  From kernel
138 1.2.3 until 1.3.77, a signal could be sent if the effective user ID of the
139 sender matched either the real or effective user ID of the target.  The
140 current rules, which conform to POSIX.1\-2001, were adopted in kernel 1.3.78.
141 .SH バグ
142 バージョン 2.6.7 以前の 2.6 系のカーネルには、 プロセスグループにシグナルを送ったときに、 呼び出し元のプロセスがプロセスグループの
143 (全メンバーではなく) 一部のメンバーに対してのみシグナルを送る許可を持っていない場合に、 \fBkill\fP()  がエラー \fBEPERM\fP
144 で失敗するというバグがある。 このエラーが返るにもかかわらず、そのシグナルは呼び出し元が シグナルを送る許可を持つ全てのプロセスへ送られる。
145 .SH 関連項目
146 \fB_exit\fP(2), \fBkillpg\fP(2), \fBsignal\fP(2), \fBtkill\fP(2), \fBexit\fP(3),
147 \fBsigqueue\fP(3), \fBcredentials\fP(7), \fBcapabilities\fP(7), \fBsignal\fP(7)
148 .SH この文書について
149 この man ページは Linux \fIman\-pages\fP プロジェクトのリリース 3.54 の一部
150 である。プロジェクトの説明とバグ報告に関する情報は
151 http://www.kernel.org/doc/man\-pages/ に書かれている。