OSDN Git Service

ecd554f32fe5ad6b81a5d5fa34df60a4c2185d81
[linuxjm/LDP_man-pages.git] / draft / man7 / signal.7
1 '\" t
2 .\" Copyright (c) 1993 by Thomas Koenig (ig25@rz.uni-karlsruhe.de)
3 .\" and Copyright (c) 2002, 2006 by Michael Kerrisk <mtk.manpages@gmail.com>
4 .\" and Copyright (c) 2008 Linux Foundation, written by Michael Kerrisk
5 .\"     <mtk.manpages@gmail.com>
6 .\"
7 .\" Permission is granted to make and distribute verbatim copies of this
8 .\" manual provided the copyright notice and this permission notice are
9 .\" preserved on all copies.
10 .\"
11 .\" Permission is granted to copy and distribute modified versions of this
12 .\" manual under the conditions for verbatim copying, provided that the
13 .\" entire resulting derived work is distributed under the terms of a
14 .\" permission notice identical to this one.
15 .\"
16 .\" Since the Linux kernel and libraries are constantly changing, this
17 .\" manual page may be incorrect or out-of-date.  The author(s) assume no
18 .\" responsibility for errors or omissions, or for damages resulting from
19 .\" the use of the information contained herein.  The author(s) may not
20 .\" have taken the same level of care in the production of this manual,
21 .\" which is licensed free of charge, as they might when working
22 .\" professionally.
23 .\"
24 .\" Formatted or processed versions of this manual, if unaccompanied by
25 .\" the source, must acknowledge the copyright and authors of this work.
26 .\"
27 .\" Modified Sat Jul 24 17:34:08 1993 by Rik Faith (faith@cs.unc.edu)
28 .\" Modified Sun Jan  7 01:41:27 1996 by Andries Brouwer (aeb@cwi.nl)
29 .\" Modified Sun Apr 14 12:02:29 1996 by Andries Brouwer (aeb@cwi.nl)
30 .\" Modified Sat Nov 13 16:28:23 1999 by Andries Brouwer (aeb@cwi.nl)
31 .\" Modified 10 Apr 2002, by Michael Kerrisk <mtk.manpages@gmail.com>
32 .\" Modified  7 Jun 2002, by Michael Kerrisk <mtk.manpages@gmail.com>
33 .\"     Added information on real-time signals
34 .\" Modified 13 Jun 2002, by Michael Kerrisk <mtk.manpages@gmail.com>
35 .\"     Noted that SIGSTKFLT is in fact unused
36 .\" 2004-12-03, Modified mtk, added notes on RLIMIT_SIGPENDING
37 .\" 2006-04-24, mtk, Added text on changing signal dispositions,
38 .\"             signal mask, and pending signals.
39 .\" 2008-07-04, mtk:
40 .\"     Added section on system call restarting (SA_RESTART)
41 .\"     Added section on stop/cont signals interrupting syscalls.
42 .\" 2008-10-05, mtk: various additions
43 .\"
44 .\" Japanese Version Copyright (c) 1997 Takafumi Naka
45 .\"     and 2005-2008 Akihiro MOTOKI
46 .\"         all rights reserved.
47 .\" Translated 1997-02-13, Takafumi Naka <takafumi@yk.rim.or.jp>
48 .\" Modified 1999-06-22, Tatsuo SEKINE <tsekine@isoternet.org>
49 .\" Modified 1999-07-18, Takafumi Naka <takafumi@yk.rim.or.jp>
50 .\" Modified 1999-12-06, NAKANO Takeo <nakano@apm.seikei.ac.jp>, LDP v1.28
51 .\" Updated 2003-07-24, Kentaro Shirakata <argrath@ub32.org>
52 .\" Updated 2005-02-23, Akihiro MOTOKI <amotoki@dd.iij4u.or.jp>
53 .\" Updated 2006-07-28, Akihiro MOTOKI <amotoki@dd.iij4u.or.jp>, LDP v2.36
54 .\" Updated 2007-05-28, Akihiro MOTOKI <amotoki@dd.iij4u.or.jp>, LDP v2.50
55 .\" Updated 2007-09-08, Akihiro MOTOKI <amotoki@dd.iij4u.or.jp>, LDP v2.64
56 .\" Updated 2008-08-11, Akihiro MOTOKI <amotoki@dd.iij4u.or.jp>, LDP v3.05
57 .\" Updated 2008-11-21, Akihiro MOTOKI <amotoki@dd.iij4u.or.jp>, LDP v3.13
58 .\" Updated 2010-04-10, Akihiro MOTOKI <amotoki@dd.iij4u.or.jp>, LDP v3.24
59 .\"
60 .\"WORD:        disposition     処理方法
61 .\"WORD:        pending         処理待ち
62 .\"WORD:        signal handler  シグナルハンドラ
63 .\"
64 .TH SIGNAL 7  2011-09-18 "Linux" "Linux Programmer's Manual"
65 .\"O .SH NAME
66 .\"O signal \- overview of signals
67 .SH 名前
68 signal \- シグナルの概要
69 .\"O .SH DESCRIPTION
70 .SH 説明
71 .\"O Linux supports both POSIX reliable signals (hereinafter
72 .\"O "standard signals") and POSIX real-time signals.
73 Linux は POSIX 信頼シグナル (reliable signal; 以後 "標準シグナル"と表記)
74 と POSIX リアルタイムシグナルの両方に対応している。
75 .\"O .SS "Signal Dispositions"
76 .SS シグナル処理方法
77 .\"O Each signal has a current
78 .\"O .IR disposition ,
79 .\"O which determines how the process behaves when it is delivered
80 .\"O the signal.
81 シグナルはそれぞれ現在の「処理方法 (disposition)」を保持しており、
82 この処理方法によりシグナルが配送された際にプロセスが
83 どのような振舞いをするかが決まる。
84
85 .\"O The entries in the "Action" column of the tables below specify
86 .\"O the default disposition for each signal, as follows:
87 後述の表の "動作" の欄のエントリは各シグナルのデフォルトの
88 処理方法を示しており、以下のような意味を持つ。
89 .IP Term
90 .\"O Default action is to terminate the process.
91 デフォルトの動作はプロセス終了。
92 .IP Ign
93 .\"O Default action is to ignore the signal.
94 デフォルトの動作はこのシグナルの無視。
95 .IP Core
96 .\"O Default action is to terminate the process and dump core (see
97 .\"O .BR core (5)).
98 デフォルトの動作はプロセス終了とコアダンプ出力
99 .RB ( core (5)
100 参照)。
101 .IP Stop
102 .\"O Default action is to stop the process.
103 デフォルトの動作はプロセスの一時停止。
104 .IP Cont
105 .\"O Default action is to continue the process if it is currently stopped.
106 デフォルトの動作は、プロセスが停止中の場合にその実行の再開。
107 .PP
108 .\"O A process can change the disposition of a signal using
109 .\"O .BR sigaction (2)
110 .\"O or
111 .\"O .BR signal (2).
112 .\"O (The latter is less portable when establishing a signal handler;
113 .\"O see
114 .\"O .BR signal (2)
115 .\"O for details.)
116 プロセスは、
117 .BR sigaction (2)
118
119 .BR signal (2)
120 を使って、シグナルの処理方法を変更することができる
121 .RB ( signal (2)
122 の方がシグナルハンドラを設定する際の移植性が低い;
123 詳細は
124 .BR signal (2)
125 を参照)。
126 .\"O Using these system calls, a process can elect one of the
127 .\"O following behaviors to occur on delivery of the signal:
128 .\"O perform the default action; ignore the signal;
129 .\"O or catch the signal with a
130 .\"O .IR "signal handler" ,
131 .\"O a programmer-defined function that is automatically invoked
132 .\"O when the signal is delivered.
133 .\"O (By default, the signal handler is invoked on the
134 .\"O normal process stack.
135 .\"O It is possible to arrange that the signal handler
136 .\"O uses an alternate stack; see
137 .\"O .BR sigaltstack (2)
138 .\"O for a discussion of how to do this and when it might be useful.)
139 シグナルの配送時に起こる動作として
140 プロセスが選択できるのは、次のいずれか一つである。
141 デフォルトの動作を実行する、シグナルを無視する、
142 .I "シグナルハンドラ (signal handler)"
143 でシグナルを捕捉する。シグナルハンドラとは、シグナル配送時に
144 自動的に起動されるプログラマ定義の関数である。
145 (デフォルトでは、シグナルハンドラは通常のプロセスのスタック上で起動される。
146 シグナルハンドラが代替スタック (alternate stack) を使用するように設定する
147 こともできる。代替スタックを使用するように設定する方法と、どのような際に
148 代替スタックが役に立つかについての議論については
149 .BR sigaltstack (2)
150 を参照のこと。
151
152 .\"O The signal disposition is a per-process attribute:
153 .\"O in a multithreaded application, the disposition of a
154 .\"O particular signal is the same for all threads.
155 シグナルの処理方法はプロセス単位の属性である。
156 マルチスレッドのアプリケーションでは、あるシグナルの処理方法は
157 全てのスレッドで同じである。
158
159 .\"O A child created via
160 .\"O .BR fork (2)
161 .\"O inherits a copy of its parent's signal dispositions.
162 .\"O During an
163 .\"O .BR execve (2),
164 .\"O the dispositions of handled signals are reset to the default;
165 .\"O the dispositions of ignored signals are left unchanged.
166 .BR fork (2)
167 で作成された子プロセスは親プロセスのシグナルの処理方法のコピーを継承する。
168 .BR execve (2)
169 の間、ハンドラが登録されているシグナルの処理方法はデフォルトにリセット
170 され、無視となっているシグナルの処理方法は変更されずそのままとなる。
171 .\"O .SS Sending a Signal
172 .SS シグナルの送信
173 .\"O The following system calls and library functions allow
174 .\"O the caller to send a signal:
175 以下のシステムコールとライブラリ関数を使って、
176 呼び出し者はシグナルを送信することができる。
177 .TP 16
178 .BR raise (3)
179 .\"O Sends a signal to the calling thread.
180 呼び出したスレッドにシグナルを送る。
181 .TP
182 .BR kill (2)
183 .\"O Sends a signal to a specified process,
184 .\"O to all members of a specified process group,
185 .\"O or to all processes on the system.
186 指定されたプロセスや、指定されたプロセスグループの全メンバー、
187 システムの全プロセスにシグナルを送る。
188 .TP
189 .BR killpg (2)
190 .\"O Sends a signal to all of the members of a specified process group.
191 指定されたプロセスグループの全メンバーにシグナルを送る。
192 .TP
193 .BR pthread_kill (3)
194 .\"O Sends a signal to a specified POSIX thread in the same process as
195 .\"O the caller.
196 呼び出し者と同じプロセス内の指定された POSIX スレッドにシグナルを送る。
197 .TP
198 .BR tgkill (2)
199 .\"O Sends a signal to a specified thread within a specific process.
200 .\"O (This is the system call used to implement
201 .\"O .BR pthread_kill (3).)
202 指定されたプロセス内の指定されたスレッドにシグナルを送る
203 (このシステムコールを使って
204 .BR pthread_kill (3)
205 は実装されている)。
206 .TP
207 .BR sigqueue (3)
208 .\"O Sends a real-time signal with accompanying data to a specified process.
209 指定されたプロセスに付属データとともにリアルタイムシグナルを送る。
210 .\"O .SS Waiting for a Signal to be Caught
211 .SS シグナルが捕捉されるのを待つ
212 .\"O The following system calls suspend execution of the calling process
213 .\"O or thread until a signal is caught
214 .\"O (or an unhandled signal terminates the process):
215 以下のシステムコールを使って、シグナルが捕捉されるまで
216 呼び出したプロセスやスレッドの実行を中断 (suspend) することができる
217 (ハンドラが設定されていないシグナルによりそのプロセスが終了した
218 場合にも実行の停止は終了する)。
219 .TP 16
220 .BR pause (2)
221 .\"O Suspends execution until any signal is caught.
222 何かシグナルが捕捉されるまで実行を停止する。
223 .TP
224 .BR sigsuspend (2)
225 .\"O Temporarily changes the signal mask (see below) and suspends
226 .\"O execution until one of the unmasked signals is caught.
227 一時的にシグナルマスク (下記参照) を変更し、
228 マスクされていないシグナルのいずれかが捕捉されるまで
229 実行を中断する。
230 .\"O .SS Synchronously Accepting a Signal
231 .SS シグナルの同期受信
232 .\"O Rather than asynchronously catching a signal via a signal handler,
233 .\"O it is possible to synchronously accept the signal, that is,
234 .\"O to block execution until the signal is delivered,
235 .\"O at which point the kernel returns information about the
236 .\"O signal to the caller.
237 .\"O There are two general ways to do this:
238 シグナルハンドラ経由でシグナルを非同期 (asynchronously) で捕捉する以外にも、
239 シグナルを同期 (synchronously) して受け付けることもできる。
240 同期して受け付けるとは、シグナルが配送されるまで実行を停止 (block)
241 するということである。シグナルを受け付けた際に、カーネルは
242 そのシグナルに関する情報を呼び出し者に返す。
243 これを行う一般的な方法が二つある。
244 .IP * 2
245 .\"O .BR sigwaitinfo (2),
246 .\"O .BR sigtimedwait (2),
247 .\"O and
248 .\"O .BR sigwait (3)
249 .\"O suspend execution until one of the signals in a specified
250 .\"O set is delivered.
251 .\"O Each of these calls returns information about the delivered signal.
252 .BR sigwaitinfo (2),
253 .BR sigtimedwait (2),
254 .BR sigwait (3)
255 は、指定されたシグナル集合のシグナルの一つが配送されるまで実行を中断する。
256 どのシステムコールや関数でも、配送されたシグナルに関する情報が返される。
257 .IP *
258 .\"O .BR signalfd (2)
259 .\"O returns a file descriptor that can be used to read information
260 .\"O about signals that are delivered to the caller.
261 .\"O Each
262 .\"O .BR read (2)
263 .\"O from this file descriptor blocks until one of the signals
264 .\"O in the set specified in the
265 .\"O .BR signalfd (2)
266 .\"O call is delivered to the caller.
267 .\"O The buffer returned by
268 .\"O .BR read (2)
269 .\"O contains a structure describing the signal.
270 .BR signalfd (2)
271 が返すファイルディスクリプタを使うと、呼び出し元に配送された
272 シグナルに関する情報を読み出すことができる。
273 このファイルディスクリプタからの
274 .BR read (2)
275 は、
276 .BR signalfd (2)
277 の呼び出し時に指定されたシグナル集合のシグナルの一つが呼び出し元に
278 配送されるまで停止 (block) する。
279 .BR read (2)
280 が返すバッファにはシグナルに関する情報を格納した構造体が入っている。
281 .\"O .SS "Signal Mask and Pending Signals"
282 .SS シグナルマスクと処理待ちシグナル
283 .\"O A signal may be
284 .\"O .IR blocked ,
285 .\"O which means that it will not be delivered until it is later unblocked.
286 .\"O Between the time when it is generated and when it is delivered
287 .\"O a signal is said to be
288 .\"O .IR pending .
289 シグナルは
290 .I "ブロック (block)"
291 されることがある。ブロックされると、そのシグナルは
292 その後ブロックを解除されるまで配送されなくなる。
293 シグナルが生成されてから配送されるまでの間、そのシグナルは
294 .I "処理待ち (pending)"
295 であると呼ばれる。
296
297 .\"O Each thread in a process has an independent
298 .\"O .IR "signal mask" ,
299 .\"O which indicates the set of signals that the thread is currently blocking.
300 .\"O A thread can manipulate its signal mask using
301 .\"O .BR pthread_sigmask (3).
302 .\"O In a traditional single-threaded application,
303 .\"O .BR sigprocmask (2)
304 .\"O can be used to manipulate the signal mask.
305 プロセス内の各スレッドは、それぞれ独立な
306 .I "シグナルマスク (signal mask)"
307 を持つ。シグナルマスクはそのスレッドが現在ブロックしている
308 シグナル集合を示すものである。
309 スレッドは、
310 .BR pthread_sigmask (3)
311 を使って自分のシグナルマスクを操作できる。
312 伝統的なシングルスレッドのアプリケーションでは、
313 .BR sigprocmask (2)
314 を使って、シグナルマスクを操作できる。
315
316 .\"O A child created via
317 .\"O .BR fork (2)
318 .\"O inherits a copy of its parent's signal mask;
319 .\"O the signal mask is preserved across
320 .\"O .BR execve (2).
321 .BR fork (2)
322 経由で作成された子プロセスは、
323 親プロセスのシグナルマスクのコピーを継承する。
324 .BR execve (2)
325 の前後でシグナルマスクは保持される。
326
327 .\"O A signal may be generated (and thus pending)
328 .\"O for a process as a whole (e.g., when sent using
329 .\"O .BR kill (2))
330 .\"O or for a specific thread (e.g., certain signals,
331 .\"O such as
332 .\"O .B SIGSEGV
333 .\"O and
334 .\"O .BR SIGFPE ,
335 .\"O generated as a
336 .\"O consequence of executing a specific machine-language instruction
337 .\"O are thread directed, as are signals targeted at a specific thread using
338 .\"O .BR pthread_kill (3)).
339 .\"O A process-directed signal may be delivered to any one of the
340 .\"O threads that does not currently have the signal blocked.
341 .\"O If more than one of the threads has the signal unblocked, then the
342 .\"O kernel chooses an arbitrary thread to which to deliver the signal.
343 生成されるシグナル (したがって処理待ちとなるシグナル) には、
344 プロセス全体宛てと特定のスレッド宛てがある。
345 例えば、プロセス全体宛てのシグナルは
346 .BR kill (2)
347 を使って送信される。
348 特定のマシン語の命令の実行の結果として生成される、
349 .B SIGSEGV
350
351 .B SIGFPE
352 などのシグナルは、スレッド宛てとなる。
353 また、
354 .BR pthread_kill (3)
355 を使って特定のスレッド宛てに生成されたシグナルも
356 スレッド宛てとなる。
357 プロセス宛てのシグナルは、そのシグナルをブロックしていないスレッドのうち
358 いずれかの一つに配送することができる。そのシグナルをブロックしていない
359 スレッドが複数ある場合、シグナルを配送するスレッドはカーネルが
360 無作為に選択する。
361
362 .\"O A thread can obtain the set of signals that it currently has pending
363 .\"O using
364 .\"O .BR sigpending (2).
365 .\"O This set will consist of the union of the set of pending
366 .\"O process-directed signals and the set of signals pending for
367 .\"O the calling thread.
368 スレッドは、
369 .BR sigpending (2)
370 を使って、現在処理待ちのシグナル集合を取得することができる。
371 この集合は、プロセス宛ての処理待ちシグナルと
372 呼び出したスレッド宛てのシグナルの両方から構成される。
373
374 .\"O A child created via
375 .\"O .BR fork (2)
376 .\"O initially has an empty pending signal set;
377 .\"O the pending signal set is preserved across an
378 .\"O .BR execve (2).
379 .BR fork (2)
380 経由で作成された子プロセスでは、処理待ちのシグナル集合は
381 空の集合で初期化される。
382 .BR execve (2)
383 の前後で、処理待ちのシグナル集合は保持される。
384 .\"O .SS "Standard Signals"
385 .SS 標準シグナル
386 .\"O Linux supports the standard signals listed below.
387 .\"O Several signal numbers
388 .\"O are architecture-dependent, as indicated in the "Value" column.
389 .\"O (Where three values are given, the first one is usually valid for
390 .\"O alpha and sparc,
391 .\"O the middle one for ix86, ia64, ppc, s390, arm and sh,
392 .\"O and the last one for mips.
393 Linux は以下に示す標準シグナルに対応している。
394 シグナル番号の一部はアーキテクチャ依存であり、"値" 欄に示す通りである。
395 (3つの値が書かれているものは、 1つ目が alpha と sparc で通常有効な値、
396 真ん中が ix86, ia64, ppc, s390, arm, sh での値、最後が mips での値である。
397 .\" parisc is a law unto itself
398 .\"O A \- denotes that a signal is absent on the corresponding architecture.)
399 \- はそのアーキテクチャにおいて対応するシグナルがないことを示す。)
400
401 .\"O First the signals described in the original POSIX.1-1990 standard.
402 最初に、POSIX.1-1990 に定義されているシグナルを示す。
403 .TS
404 l c c l
405 ____
406 lB c c l.
407 .\"O Signal     Value   Action  Comment
408 シグナル    値     動作  コメント
409 .\"O SIGHUP     \01     Term    Hangup detected on controlling terminal
410 .\"O                    or death of controlling process
411 SIGHUP  \01     Term    T{
412 制御端末(controlling terminal)のハングアップ検出、
413 または制御しているプロセスの死
414 T}
415 .\"O SIGINT     \02     Term    Interrupt from keyboard
416 .\"O SIGQUIT    \03     Core    Quit from keyboard
417 .\"O SIGILL     \04     Core    Illegal Instruction
418 .\"O SIGABRT    \06     Core    Abort signal from \fBabort\fP(3)
419 .\"O SIGFPE     \08     Core    Floating point exception
420 .\"O SIGKILL    \09     Term    Kill signal
421 SIGINT  \02     Term    キーボードからの割り込み (Interrupt)
422 SIGQUIT \03     Core    キーボードによる中止 (Quit)
423 SIGILL  \04     Core    不正な命令
424 SIGABRT \06     Core    \fBabort\fP(3) からの中断 (Abort) シグナル
425 SIGFPE  \08     Core    浮動小数点例外
426 SIGKILL \09     Term    Kill シグナル
427 .\"O SIGSEGV    11      Core    Invalid memory reference
428 .\"O SIGPIPE    13      Term    Broken pipe: write to pipe with no
429 .\"O                    readers
430 .\"O SIGALRM    14      Term    Timer signal from \fBalarm\fP(2)
431 .\"O SIGTERM    15      Term    Termination signal
432 SIGSEGV 11      Core    不正なメモリ参照
433 SIGPIPE 13      Term    パイプ破壊: 読み手の無いパイプへの書き出し
434 SIGALRM 14      Term    \fBalarm\fP(2) からのタイマーシグナル
435 SIGTERM 15      Term    終了 (termination) シグナル
436 .\"O SIGUSR1    30,10,16        Term    User-defined signal 1
437 .\"O SIGUSR2    31,12,17        Term    User-defined signal 2
438 .\"O SIGCHLD    20,17,18        Ign     Child stopped or terminated
439 .\"O SIGCONT    19,18,25        Cont    Continue if stopped
440 SIGUSR1 30,10,16        Term    ユーザ定義シグナル 1
441 SIGUSR2 31,12,17        Term    ユーザ定義シグナル 2
442 SIGCHLD 20,17,18        Ign     子プロセスの一時停止 (stop) または終了
443 SIGCONT 19,18,25        Cont    一時停止 (stop) からの再開
444 .\"O SIGSTOP    17,19,23        Stop    Stop process
445 .\"O SIGTSTP    18,20,24        Stop    Stop typed at tty
446 .\"O SIGTTIN    21,21,26        Stop    tty input for background process
447 .\"O SIGTTOU    22,22,27        Stop    tty output for background process
448 SIGSTOP 17,19,23        Stop    プロセスの一時停止 (stop)
449 SIGTSTP 18,20,24        Stop    端末 (tty) より入力された一時停止 (stop)
450 SIGTTIN 21,21,26        Stop    バックグランドプロセスの tty 入力
451 SIGTTOU 22,22,27        Stop    バックグランドプロセスの tty 出力
452 .TE
453
454 .\"O The signals
455 .\"O .B SIGKILL
456 .\"O and
457 .\"O .B SIGSTOP
458 .\"O cannot be caught, blocked, or ignored.
459 シグナル
460 .B SIGKILL
461
462 .B SIGSTOP
463 はキャッチ、ブロック、無視できない。
464
465 .\"O Next the signals not in the POSIX.1-1990 standard but described in
466 .\"O SUSv2 and POSIX.1-2001.
467 次に、 POSIX.1-1990 標準にはないが、 SUSv2 と
468 POSIX.1-2001 に記述されているシグナルを示す。
469 .TS
470 l c c l
471 ____
472 lB c c l.
473 .\"O Signal     Value   Action  Comment
474 シグナル    値     動作  コメント
475 .\"O SIGBUS     10,7,10 Core    Bus error (bad memory access)
476 .\"O SIGPOLL            Term    Pollable event (Sys V).
477 .\"O                    Synonym for \fBSIGIO\fP
478 .\"O SIGPROF    27,27,29        Term    Profiling timer expired
479 SIGBUS  10,7,10 Core    バスエラー (不正なメモリアクセス)
480 SIGPOLL         Term    ポーリング可能なイベント (Sys V)。
481                         \fBSIGIO\fP と同義
482 SIGPROF 27,27,29        Term    profiling タイマの時間切れ
483 .\"O SIGSYS     12,31,12        Core    Bad argument to routine (SVr4)
484 .\"O SIGTRAP    5       Core    Trace/breakpoint trap
485 .\"O SIGURG     16,23,21        Ign     Urgent condition on socket (4.2BSD)
486 SIGSYS  12,31,12        Core    ルーチンへの引き数が不正 (SVr4)
487 SIGTRAP 5       Core    トレース/ブレークポイント トラップ
488 SIGURG  16,23,21        Ign     T{
489 ソケットの緊急事態 (urgent condition) (4.2BSD)
490 T}
491 .\"O SIGVTALRM  26,26,28        Term    Virtual alarm clock (4.2BSD)
492 .\"O SIGXCPU    24,24,30        Core    CPU time limit exceeded (4.2BSD)
493 .\"O SIGXFSZ    25,25,31        Core    File size limit exceeded (4.2BSD)
494 SIGVTALRM       26,26,28        Term    仮想アラームクロック (4.2BSD)
495 SIGXCPU 24,24,30        Core    CPU時間制限超過 (4.2BSD)
496 SIGXFSZ 25,25,31        Core    ファイルサイズ制限の超過 (4.2BSD)
497 .TE
498
499 .\"O Up to and including Linux 2.2, the default behavior for
500 .\"O .BR SIGSYS ", " SIGXCPU ", " SIGXFSZ ", "
501 .\"O and (on architectures other than SPARC and MIPS)
502 .\"O .B SIGBUS
503 .\"O was to terminate the process (without a core dump).
504 .\"O (On some other UNIX systems the default action for
505 .\"O .BR SIGXCPU " and " SIGXFSZ
506 .\"O is to terminate the process without a core dump.)
507 .\"O Linux 2.4 conforms to the POSIX.1-2001 requirements for these signals,
508 .\"O terminating the process with a core dump.
509 Linux 2.2 以前では、
510 .BR SIGSYS ", " SIGXCPU ", " SIGXFSZ
511 および SPARC と MIPS 以外のアーキテクチャでの
512 .B SIGBUS
513 のデフォルトの振る舞いは (コアダンプ出力なしの) プロセス終了であった。
514 (他の UNIX システムにも
515 .BR SIGXCPU " と " SIGXFSZ
516 のデフォルトの動作がコアダンプなしのプロセス終了のものがある。)
517 Linux 2.4 では、POSIX.1-2001 での要求仕様に準拠して、
518 これらのシグナルで、プロセスを終了させ、コアダンプを出力する
519 ようになっている。
520
521 .\"O Next various other signals.
522 次にその他の各種シグナルを示す。
523 .TS
524 l c c l
525 ____
526 lB c c l.
527 .\"O Signal     Value   Action  Comment
528 シグナル    値     動作  コメント
529 .\"O SIGIOT     6       Core    IOT trap. A synonym for \fBSIGABRT\fP
530 .\"O SIGEMT     7,\-,7  Term
531 .\"O SIGSTKFLT  \-,16,\-        Term    Stack fault on coprocessor (unused)
532 .\"O SIGIO      23,29,22        Term    I/O now possible (4.2BSD)
533 .\"O SIGCLD     \-,\-,18        Ign     A synonym for \fBSIGCHLD\fP
534 SIGIOT  6       Core    IOT トラップ。\fBSIGABRT\fP と同義
535 SIGEMT  7,\-,7  Term
536 SIGSTKFLT       \-,16,\-        A       T{
537 数値演算プロセッサにおけるスタックフォルト (未使用)
538 T}
539 SIGIO   23,29,22        Term    入出力が可能になった (4.2BSD)
540 SIGCLD  \-,\-,18        Ign     \fBSIGCHLD\fP と同義
541 .\"O SIGPWR     29,30,19        Term    Power failure (System V)
542 .\"O SIGINFO    29,\-,\-                A synonym for \fBSIGPWR\fP
543 .\"O SIGLOST    \-,\-,\-        Term    File lock lost
544 .\"O SIGWINCH   28,28,20        Ign     Window resize signal (4.3BSD, Sun)
545 .\"O SIGUNUSED  \-,31,\-        Core    Synonymous with \fBSIGSYS\fP
546 SIGPWR  29,30,19        Term    電源喪失 (Power failure) (System V)
547 SIGINFO 29,\-,\-                \fBSIGPWR\fP と同義
548 SIGLOST \-,\-,\-        Term    ファイルロックが失われた
549 SIGWINCH        28,28,20        Ign     T{
550 ウィンドウ リサイズ シグナル (4.3BSD, Sun)
551 T}
552 SIGUNUSED       \-,31,\-        Core    \fBSIGSYS\fP と同義
553 .TE
554
555 .\"O (Signal 29 is
556 .\"O .B SIGINFO
557 .\"O /
558 .\"O .B SIGPWR
559 .\"O on an alpha but
560 .\"O .B SIGLOST
561 .\"O on a sparc.)
562 (シグナル 29 は alpha では
563 .B SIGINFO
564 /
565 .B SIGPWR
566 だが、sparc では
567 .B SIGLOST
568 である。)
569
570 .\"O .B SIGEMT
571 .\"O is not specified in POSIX.1-2001, but nevertheless appears
572 .\"O on most other UNIX systems,
573 .\"O where its default action is typically to terminate
574 .\"O the process with a core dump.
575 .B SIGEMT
576 は POSIX.1-2001 に規定されていないが、
577 その他の多くの UNIX システムに存在する。
578 デフォルトの動作は多くの場合、コアダンプ出力を伴うプロセスの終了である。
579
580 .\"O .B SIGPWR
581 .\"O (which is not specified in POSIX.1-2001) is typically ignored
582 .\"O by default on those other UNIX systems where it appears.
583 .B SIGPWR
584 は (POSIX.1-2001 に規定されていないが) このシグナルが存在する
585 他の UNIX システムでは多くの場合、デフォルト動作は無視である。
586
587 .\"O .B SIGIO
588 .\"O (which is not specified in POSIX.1-2001) is ignored by default
589 .\"O on several other UNIX systems.
590 .B SIGIO
591 は (POSIX.1-2001 に規定されていないが) いくつかの他の UNIX システムでは
592 デフォルト動作は無視である。
593
594 .\"O Where defined,
595 .\"O .B SIGUNUSED
596 .\"O is synonymous with
597 .\"O .\" parisc is the only exception: SIGSYS is 12, SIGUNUSED is 31
598 .\"O .B SIGSYS
599 .\"O on most architectures.
600 .B SIGUNUSED
601 が定義されている場合には、ほとんどのアーキテクチャで
602 .B SIGSYS
603 の同義語となっている。
604 .\" parisc is the only exception: SIGSYS is 12, SIGUNUSED is 31
605 .\"O .SS "Real-time Signals"
606 .SS リアルタイムシグナル
607 .\"O Linux supports real-time signals as originally defined in the POSIX.1b
608 .\"O real-time extensions (and now included in POSIX.1-2001).
609 Linux はリアルタイムシグナルをサポートしている。
610 リアルタイムシグナルは元々 POSIX.1b のリアルタイム拡張で定義されて
611 いるものであり、現在では POSIX.1-2001 に含まれている。
612 .\"O The range of supported real-time signals is defined by the macros
613 .\"O .B SIGRTMIN
614 .\"O and
615 .\"O .BR SIGRTMAX .
616 .\"O POSIX.1-2001 requires that an implementation support at least
617 .\"O .B _POSIX_RTSIG_MAX
618 .\"O (8) real-time signals.
619 対応しているリアルタイムシグナルの範囲は、マクロ
620 .B SIGRTMIN
621
622 .B SIGRTMAX
623 で定義される。
624 POSIX.1-2001 では、少なくとも
625 .B _POSIX_RTSIG_MAX
626 (8) 個のリアルタイムシグナルに対応した実装が要求されている。
627 .PP
628 .\"O The Linux kernel supports a range of 32 different real-time
629 .\"O signals, numbered 33 to 64.
630 .\"O However, the glibc POSIX threads implementation internally uses
631 .\"O two (for NPTL) or three (for LinuxThreads) real-time signals
632 .\"O (see
633 .\"O .BR pthreads (7)),
634 .\"O and adjusts the value of
635 .\"O .B SIGRTMIN
636 .\"O suitably (to 34 or 35).
637 Linux は、32 個の異なるリアルタイムシグナルに対応しており、
638 その番号は 33 から 64 である。
639 しかしながら、glibc の POSIX スレッド実装は、
640 内部で 2個 (NPTL の場合) か 3個 (LinuxThreads の場合) の
641 リアルタイムシグナルを使用しており
642 .RB ( pthreads (7)
643 参照)、
644 .B SIGRTMIN
645 の値を適切に (34 か 35 に) 調整する。
646 .\"O Because the range of available real-time signals varies according
647 .\"O to the glibc threading implementation (and this variation can occur
648 .\"O at run time according to the available kernel and glibc),
649 .\"O and indeed the range of real-time signals varies across UNIX systems,
650 .\"O programs should
651 .\"O .IR "never refer to real-time signals using hard-coded numbers" ,
652 .\"O but instead should always refer to real-time signals using the notation
653 .\"O .BR SIGRTMIN +n,
654 .\"O and include suitable (run-time) checks that
655 .\"O .BR SIGRTMIN +n
656 .\"O does not exceed
657 .\"O .BR SIGRTMAX .
658 利用可能なリアルタイムシグナルの範囲は glibc のスレッド実装により
659 異なるし (使用するカーネルと glibc により実行時にも変化する)、
660 UNIX システムの種類によっても異なる。したがって、
661 プログラムでは「ハードコーディングした数字を使ってのリアルタイムシグナルの
662 参照は決してすべきではなく」、代わりに
663 .BR SIGRTMIN +n
664 の形で参照すべきである。また、
665 .BR SIGRTMIN +n
666
667 .B SIGRTMAX
668 を超えていないかのチェックを (実行時に) 適切に行うべきである。
669 .PP
670 .\"O Unlike standard signals, real-time signals have no predefined meanings:
671 .\"O the entire set of real-time signals can be used for application-defined
672 .\"O purposes.
673 標準シグナルと異なり、リアルタイムシグナルには
674 事前に定義された意味はない。
675 リアルタイムシグナルの全部をアプリケーションで定義した用途に使える。
676 .PP
677 .\"O The default action for an unhandled real-time signal is to terminate the
678 .\"O receiving process.
679 ハンドリングしないリアルタイムシグナルのデフォルトの動作は
680 受信したプロセスの終了である。
681 .PP
682 .\"O Real-time signals are distinguished by the following:
683 リアルタイムシグナルは以下の特徴がある:
684 .IP 1. 4
685 .\"O Multiple instances of real-time signals can be queued.
686 .\"O By contrast, if multiple instances of a standard signal are delivered
687 .\"O while that signal is currently blocked, then only one instance is queued.
688 リアルタイムシグナルは複数の実体をキューに入れることができる。
689 一方、標準シグナルの場合、そのシグナルがブロックされている間に
690 同じシグナルの複数のインスタンスが配送されても、
691 1 つだけがキューに入れられる。
692 .IP 2. 4
693 .\"O If the signal is sent using
694 .\"O .BR sigqueue (3),
695 .\"O an accompanying value (either an integer or a pointer) can be sent
696 .\"O with the signal.
697 シグナルが
698 .BR sigqueue (3)
699 を用いて送信された場合、
700 付属データ (整数かポインタ) をシグナルと共に送信できる。
701 .\"O If the receiving process establishes a handler for this signal using the
702 .\"O .B SA_SIGINFO
703 .\"O flag to
704 .\"O .BR sigaction (2)
705 .\"O then it can obtain this data via the
706 .\"O .I si_value
707 .\"O field of the
708 .\"O .I siginfo_t
709 .\"O structure passed as the second argument to the handler.
710 受信側プロセスが
711 .BR sigaction (2)
712
713 .B SA_SIGINFO
714 フラグを指定してシグナルハンドラを設定した場合、
715 このデータは
716 .I siginfo_t
717 構造体の
718 .I si_value
719 フィールド経由でハンドラの第 2 引き数として渡され、
720 利用することができる。
721 .\"O Furthermore, the
722 .\"O .I si_pid
723 .\"O and
724 .\"O .I si_uid
725 .\"O fields of this structure can be used to obtain the PID
726 .\"O and real user ID of the process sending the signal.
727 さらに、この構造体の
728 .I si_pid
729
730 .I si_uid
731 フィールドでシグナルを送信したプロセスの PID と実ユーザ ID を
732 得ることができる。
733 .IP 3. 4
734 .\"O Real-time signals are delivered in a guaranteed order.
735 .\"O Multiple real-time signals of the same type are delivered in the order
736 .\"O they were sent.
737 .\"O If different real-time signals are sent to a process, they are delivered
738 .\"O starting with the lowest-numbered signal.
739 .\"O (I.e., low-numbered signals have highest priority.)
740 .\"O By contrast, if multiple standard signals are pending for a process,
741 .\"O the order in which they are delivered is unspecified.
742 リアルタイムシグナルでは配送される順序が保証される。
743 同じタイプのリアルタイムシグナルは送信された順番に到着する。
744 異なるリアルタイムシグナルが一つのプロセスに送信された場合、
745 番号の小さいシグナルから先に到着する。
746 (つまり小さい番号のシグナルが高い優先順位を持つ。)
747 対照的に、一つのプロセスに対して複数の標準シグナルが処理待ちとなった場合、
748 これらのシグナルが配送される順序は不定である。
749 .PP
750 .\"O If both standard and real-time signals are pending for a process,
751 .\"O POSIX leaves it unspecified which is delivered first.
752 .\"O Linux, like many other implementations, gives priority
753 .\"O to standard signals in this case.
754 一つのプロセスに対して標準シグナルとリアルタイムシグナルの両方が
755 処理待ちの場合、POSIX はどちらが先に配送されるかを規定していない。
756 Linux では、他の多くの実装と同様、このような場合には
757 標準シグナルが優先される。
758 .PP
759 .\"O According to POSIX, an implementation should permit at least
760 .\"O .B _POSIX_SIGQUEUE_MAX
761 .\"O (32) real-time signals to be queued to
762 .\"O a process.
763 POSIX によれば、1 プロセス毎に最低
764 .B _POSIX_SIGQUEUE_MAX
765 (32) 個のリアルタイムシグナルをキューに入れられるべきとしている。
766 .\"O However, Linux does things differently.
767 .\"O In kernels up to and including 2.6.7, Linux imposes
768 .\"O a system-wide limit on the number of queued real-time signals
769 .\"O for all processes.
770 しかし、 Linux では違った実装になっている。カーネル 2.6.7 までは
771 (2.6.7 を含む)、全プロセスでキューに入っているリアルタイムシグナル
772 の数の合計についてシステム全体での制限がある。
773 .\"O This limit can be viewed and (with privilege) changed via the
774 .\"O .I /proc/sys/kernel/rtsig-max
775 .\"O file.
776 .\"O A related file,
777 .\"O .IR /proc/sys/kernel/rtsig-nr ,
778 .\"O can be used to find out how many real-time signals are currently queued.
779 この制限は
780 .I /proc/sys/kernel/rtsig-max
781 ファイルで見ることができ、 (権限があれば) 変更もできる。
782 関係するファイルとして、
783 .I /proc/sys/kernel/rtsig-nr
784 を見ることで、いくつのリアルタイムシグナルが現在キューに入っているかを
785 知ることができる。
786 .\"O In Linux 2.6.8, these
787 .\"O .I /proc
788 .\"O interfaces were replaced by the
789 .\"O .B RLIMIT_SIGPENDING
790 .\"O resource limit, which specifies a per-user limit for queued
791 .\"O signals; see
792 .\"O .BR setrlimit (2)
793 .\"O for further details.
794 Linux 2.6.8 で、これらの
795 .I /proc
796 経由のインターフェースは、
797 .B RLIMIT_SIGPENDING
798 リソース制限に置き換えられた。
799 これは、キューに入るシグナル数に関してユーザ単位に
800 上限を指定するものである。
801 詳しくは
802 .BR setrlimit (2)
803 を参照。
804 .\"O .SS "Async-signal-safe functions"
805 .SS "非同期シグナルで安全な関数 (async-signal-safe functions)"
806 .PP
807 .\"O A signal handler function must be very careful,
808 .\"O since processing elsewhere may be interrupted
809 .\"O at some arbitrary point in the execution of the program.
810 .\"O POSIX has the concept of "safe function".
811 .\"O If a signal interrupts the execution of an unsafe function, and
812 .\"O .I handler
813 .\"O calls an unsafe function, then the behavior of the program is undefined.
814 シグナルハンドラ関数には非常に注意しなければならない。
815 他の場所の処理はプログラム実行の任意の箇所で中断される可能性があるためである。
816 POSIX には「安全な関数 (safe function)」という概念がある。
817 シグナルが安全でない関数の実行を中断し、かつ
818 .I handler
819 が安全でない関数を呼び出した場合、プログラムの挙動は未定義である。
820
821 .\"O POSIX.1-2004 (also known as POSIX.1-2001 Technical Corrigendum 2)
822 .\"O requires an implementation to guarantee that the following
823 .\"O functions can be safely called inside a signal handler:
824 POSIX.1-2004 (POSIX.1-2001 Technical Corrigendum (正誤表) 2 とも言う) では、
825 シグナルハンドラ内での安全な呼び出しを保証することが必須の関数として
826 以下が規定されている。
827
828 .in +4
829 .nf
830 _Exit()
831 _exit()
832 abort()
833 accept()
834 access()
835 aio_error()
836 aio_return()
837 aio_suspend()
838 alarm()
839 bind()
840 cfgetispeed()
841 cfgetospeed()
842 cfsetispeed()
843 cfsetospeed()
844 chdir()
845 chmod()
846 chown()
847 clock_gettime()
848 close()
849 connect()
850 creat()
851 dup()
852 dup2()
853 execle()
854 execve()
855 fchmod()
856 fchown()
857 fcntl()
858 fdatasync()
859 fork()
860 fpathconf()
861 fstat()
862 fsync()
863 ftruncate()
864 getegid()
865 geteuid()
866 getgid()
867 getgroups()
868 getpeername()
869 getpgrp()
870 getpid()
871 getppid()
872 getsockname()
873 getsockopt()
874 getuid()
875 kill()
876 link()
877 listen()
878 lseek()
879 lstat()
880 mkdir()
881 mkfifo()
882 open()
883 pathconf()
884 pause()
885 pipe()
886 poll()
887 posix_trace_event()
888 pselect()
889 raise()
890 read()
891 readlink()
892 recv()
893 recvfrom()
894 recvmsg()
895 rename()
896 rmdir()
897 select()
898 sem_post()
899 send()
900 sendmsg()
901 sendto()
902 setgid()
903 setpgid()
904 setsid()
905 setsockopt()
906 setuid()
907 shutdown()
908 sigaction()
909 sigaddset()
910 sigdelset()
911 sigemptyset()
912 sigfillset()
913 sigismember()
914 signal()
915 sigpause()
916 sigpending()
917 sigprocmask()
918 sigqueue()
919 sigset()
920 sigsuspend()
921 sleep()
922 sockatmark()
923 socket()
924 socketpair()
925 stat()
926 symlink()
927 sysconf()
928 tcdrain()
929 tcflow()
930 tcflush()
931 tcgetattr()
932 tcgetpgrp()
933 tcsendbreak()
934 tcsetattr()
935 tcsetpgrp()
936 time()
937 timer_getoverrun()
938 timer_gettime()
939 timer_settime()
940 times()
941 umask()
942 uname()
943 unlink()
944 utime()
945 wait()
946 waitpid()
947 write()
948 .fi
949 .in
950 .PP
951 .\"O POSIX.1-2008 removes fpathconf(), pathconf(), and sysconf()
952 .\"O from the above list, and adds the following functions:
953 POSIX.1-2008 では、上記のリストのうち fpathconf(), pathconf(), sysconf()
954 が削除され、以下の関数が追加された。
955 .PP
956 .in +4n
957 .nf
958 execl()
959 execv()
960 faccessat()
961 fchmodat()
962 fchownat()
963 fexecve()
964 fstatat()
965 futimens()
966 linkat()
967 mkdirat()
968 mkfifoat()
969 mknod()
970 mknodat()
971 openat()
972 readlinkat()
973 renameat()
974 symlinkat()
975 unlinkat()
976 utimensat()
977 utimes()
978 .fi
979 .in
980 .\"O .SS Interruption of System Calls and Library Functions by Signal Handlers
981 .SS シグナルハンドラによるシステムコールやライブラリ関数への割り込み
982 .\"O If a signal handler is invoked while a system call or library
983 .\"O function call is blocked, then either:
984 システムコールやライブラリが停止 (block) している間にシグナルハンドラが
985 起動されると、以下のどちらかとなる。
986 .IP * 2
987 .\"O the call is automatically restarted after the signal handler returns; or
988 シグナルが返った後、呼び出しは自動的に再スタートされる。
989 .IP *
990 .\"O the call fails with the error
991 .\"O .BR EINTR .
992 呼び出しはエラー
993 .B EINTR
994 で失敗する。
995 .PP
996 .\"O Which of these two behaviors occurs depends on the interface and
997 .\"O whether or not the signal handler was established using the
998 .\"O .BR SA_RESTART
999 .\"O flag (see
1000 .\"O .BR sigaction (2)).
1001 .\"O The details vary across UNIX systems;
1002 .\"O below, the details for Linux.
1003 これらの二つの挙動のうちどちらが起こるかは、インターフェイスにより依存し、
1004 シグナルハンドラが
1005 .B SA_RESTART
1006 フラグ
1007 .RB ( sigaction (2)
1008 参照) を使って設定されていたかにも依存する。
1009 詳細は UNIX システムによって異なる。
1010 Linux における詳細を以下で説明する。
1011
1012 .\"O If a blocked call to one of the following interfaces is interrupted
1013 .\"O by a signal handler, then the call will be automatically restarted
1014 .\"O after the signal handler returns if the
1015 .\"O .BR SA_RESTART
1016 .\"O flag was used; otherwise the call will fail with the error
1017 .\"O .BR EINTR :
1018 .\"O .\" The following system calls use ERESTARTSYS,
1019 .\"O .\" so that they are restartable
1020 以下のインターフェイスのいずれかの呼び出しが停止している間に
1021 シグナルハンドラにより割り込まれた場合、
1022 .B SA_RESTART
1023 フラグが使用されていれば、シグナルハンドラが返った後に
1024 その呼び出しは自動的に再スタートされることになる。
1025 それ以外の場合は、その呼び出しはエラー
1026 .B EINTR
1027 で失敗することになる。
1028 .\" 以下のシステムコールは ERESTARTSYS を使っている。
1029 .\" そのため、これらは再スタートが可能である。
1030 .RS 4
1031 .IP * 2
1032 .\"O .BR read (2),
1033 .\"O .BR readv (2),
1034 .\"O .BR write (2),
1035 .\"O .BR writev (2),
1036 .\"O and
1037 .\"O .BR ioctl (2)
1038 .\"O calls on "slow" devices.
1039 .\"O A "slow" device is one where the I/O call may block for an
1040 .\"O indefinite time, for example, a terminal, pipe, or socket.
1041 .\"O (A disk is not a slow device according to this definition.)
1042 .\"O If an I/O call on a slow device has already transferred some
1043 .\"O data by the time it is interrupted by a signal handler,
1044 .\"O then the call will return a success status
1045 .\"O (normally, the number of bytes transferred).
1046 .BR read (2),
1047 .BR readv (2),
1048 .BR write (2),
1049 .BR writev (2),
1050 .BR ioctl (2)
1051 の「遅い (slow)」デバイスに対する呼び出し。
1052 ここでいう「遅い」デバイスとは、I/O 呼び出しが無期限に停止 (block) する
1053 可能性のあるデバイスのことで、例としては端末、パイプ、ソケットがある
1054 (この定義では、ディスクは遅いデバイスではない)。
1055 遅いデバイスに対する I/O 呼び出しが、
1056 シグナルハンドラにより割り込まれた時点までに何らかのデータを
1057 すでに転送していれば、呼び出しは成功ステータス
1058 (通常は、転送されたバイト数) を返すことだろう。
1059 .IP *
1060 .\"O .BR open (2),
1061 .\"O if it can block (e.g., when opening a FIFO; see
1062 .\"O .BR fifo (7)).
1063 停止 (block) する可能性のある
1064 .BR open (2)
1065 (例えば、FIFO のオープン時;
1066 .BR fifo (7)
1067 参照)。
1068 .IP *
1069 .\"O .BR wait (2),
1070 .\"O .BR wait3 (2),
1071 .\"O .BR wait4 (2),
1072 .\"O .BR waitid (2),
1073 .\"O and
1074 .\"O .BR waitpid (2).
1075 .BR wait (2),
1076 .BR wait3 (2),
1077 .BR wait4 (2),
1078 .BR waitid (2),
1079 .BR waitpid (2).
1080 .IP *
1081 .\"O Socket interfaces:
1082 ソケットインターフェイス:
1083 .\" If a timeout (setsockopt()) is in effect on the socket, then these
1084 .\" system calls switch to using EINTR.  Consequently, they and are not
1085 .\" automatically restarted, and they show the stop/cont behavior
1086 .\" described below.  (Verified from 2.6.26 source, and by experiment; mtk)
1087 .\"O .BR accept (2),
1088 .\"O .BR connect (2),
1089 .\"O .BR recv (2),
1090 .\"O .BR recvfrom (2),
1091 .\"O .BR recvmsg (2),
1092 .\"O .BR send (2),
1093 .\"O .BR sendto (2),
1094 .\"O and
1095 .\"O .BR sendmsg (2),
1096 .\"O unless a timeout has been set on the socket (see below).
1097 .BR accept (2),
1098 .BR connect (2),
1099 .BR recv (2),
1100 .BR recvfrom (2),
1101 .BR recvmsg (2),
1102 .BR send (2),
1103 .BR sendto (2),
1104 .BR sendmsg (2).
1105 但し、ソケットにタイムアウトが設定されていない場合 (下記参照)。
1106 .IP *
1107 .\"O File locking interfaces:
1108 ファイルロック用インターフェイス:
1109 .\"O .BR flock (2)
1110 .\"O and
1111 .\"O .BR fcntl (2)
1112 .\"O .BR F_SETLKW .
1113 .BR flock (2),
1114 .BR fcntl (2)
1115 .BR F_SETLKW .
1116 .IP *
1117 .\"O POSIX message queue interfaces:
1118 POSIX メッセージキューインターフェイス:
1119 .BR mq_receive (3),
1120 .BR mq_timedreceive (3),
1121 .BR mq_send (3),
1122 .\"O and
1123 .BR mq_timedsend (3).
1124 .IP *
1125 .BR futex (2)
1126 .B FUTEX_WAIT
1127 .\"O (since Linux 2.6.22; beforehand, always failed with
1128 .\"O .BR EINTR ).
1129 (Linux 2.6.22 以降; それ以前は常に
1130 .B EINTR
1131 で失敗していた)。
1132 .IP *
1133 .\"O POSIX semaphore interfaces:
1134 POSIX セマフォインターフェイス:
1135 .\"O .BR sem_wait (3)
1136 .\"O and
1137 .\"O .BR sem_timedwait (3)
1138 .\"O (since Linux 2.6.22; beforehand, always failed with
1139 .\"O .BR EINTR ).
1140 .BR sem_wait (3),
1141 .BR sem_timedwait (3)
1142 (Linux 2.6.22 以降; それ以前は常に
1143 .B EINTR
1144 で失敗していた)。
1145 .RE
1146 .PP
1147 .\"O The following interfaces are never restarted after
1148 .\"O being interrupted by a signal handler,
1149 .\"O regardless of the use of
1150 .\"O .BR SA_RESTART ;
1151 .\"O they always fail with the error
1152 .\"O .B EINTR
1153 .\"O when interrupted by a signal handler:
1154 .\"O .\" These are the system calls that give EINTR or ERESTARTNOHAND
1155 .\"O .\" on interruption by a signal handler.
1156 以下のインターフェイスは、
1157 .B SA_RESTART
1158 を使っているどうかに関わらず、シグナルハンドラにより割り込まれた後、
1159 再スタートすることは決してない。
1160 これらは、シグナルハンドラにより割り込まれると、常にエラー
1161 .B EINTR
1162 で失敗する。
1163 .\" これらは、シグナルハンドラによる割り込みの際に
1164 .\" EINTR か ERESTARTNOHAND を返すシステムコールである。
1165 .RS 4
1166 .IP * 2
1167 .\"O Socket interfaces, when a timeout has been set on the socket using
1168 .\"O .BR setsockopt (2):
1169 .\"O .BR accept (2),
1170 .\"O .BR recv (2),
1171 .\"O .BR recvfrom (2),
1172 .\"O and
1173 .\"O .BR recvmsg (2),
1174 .\"O if a receive timeout
1175 .\"O .RB ( SO_RCVTIMEO )
1176 .\"O has been set;
1177 .\"O .BR connect (2),
1178 .\"O .BR send (2),
1179 .\"O .BR sendto (2),
1180 .\"O and
1181 .\"O .BR sendmsg (2),
1182 .\"O if a send timeout
1183 .\"O .RB ( SO_SNDTIMEO )
1184 .\"O has been set.
1185 .BR setsockopt (2)
1186 を使ってタイムアウトが設定されているソケットインターフェース:
1187 .BR accept (2),
1188 .BR recv (2),
1189 .BR recvfrom (2),
1190 .BR recvmsg (2)
1191 で受信タイムアウト
1192 .RB ( SO_RCVTIMEO )
1193 が設定されている場合と、
1194 .BR connect (2),
1195 .BR send (2),
1196 .BR sendto (2),
1197 .BR sendmsg (2)
1198 で送信タイムアウト
1199 .RB ( SO_SNDTIMEO )
1200 が設定されている場合。
1201 .IP *
1202 .\"O Interfaces used to wait for signals:
1203 シグナル待ちに使われるインターフェイス:
1204 .BR pause (2),
1205 .BR sigsuspend (2),
1206 .BR sigtimedwait (2),
1207 .\"O and
1208 .BR sigwaitinfo (2).
1209 .IP *
1210 .\"O File descriptor multiplexing interfaces:
1211 ファイルディスクリプタ多重インターフェイス:
1212 .BR epoll_wait (2),
1213 .BR epoll_pwait (2),
1214 .BR poll (2),
1215 .BR ppoll (2),
1216 .BR select (2),
1217 .\"O and
1218 .BR pselect (2).
1219 .IP *
1220 .\"O System V IPC interfaces:
1221 System V IPC インターフェイス:
1222 .\" On some other systems, SA_RESTART does restart these system calls
1223 .BR msgrcv (2),
1224 .BR msgsnd (2),
1225 .BR semop (2),
1226 .\"O and
1227 .BR semtimedop (2).
1228 .IP *
1229 .\"O Sleep interfaces:
1230 スリープ用のインターフェイス:
1231 .BR clock_nanosleep (2),
1232 .BR nanosleep (2),
1233 .\"O and
1234 .BR usleep (3).
1235 .IP *
1236 .\"O .BR read (2)
1237 .\"O from an
1238 .\"O .BR inotify (7)
1239 .\"O file descriptor.
1240 .BR inotify (7)
1241 ファイルディスクリプタからの
1242 .BR read (2).
1243 .IP *
1244 .BR io_getevents (2).
1245 .RE
1246 .PP
1247 .\"O The
1248 .\"O .BR sleep (3)
1249 .\"O function is also never restarted if interrupted by a handler,
1250 .\"O but gives a success return: the number of seconds remaining to sleep.
1251 .BR sleep (3)
1252 関数も、ハンドラにより割り込まれた場合、決して再スタートされることはない。
1253 しかし、成功となり、残っている停止時間を返す。
1254 .\"O .SS Interruption of System Calls and Library Functions by Stop Signals
1255 .SS 一時停止シグナルによるシステムコールやライブラリ関数への割り込み
1256 .\"O On Linux, even in the absence of signal handlers,
1257 .\"O certain blocking interfaces can fail with the error
1258 .\"O .BR EINTR
1259 .\"O after the process is stopped by one of the stop signals
1260 .\"O and then resumed via
1261 .\"O .BR SIGCONT .
1262 .\"O This behavior is not sanctioned by POSIX.1, and doesn't occur
1263 .\"O on other systems.
1264 Linux では、シグナルハンドラが設定されていない場合でも、
1265 いくつかのブロッキング型のインターフェイスは、
1266 プロセスが一時停止 (stop) シグナルの一つにより停止され、
1267 .B SIGCONT
1268 により再開された後に、エラー
1269 .B EINTR
1270 で失敗する可能性がある。
1271 この挙動は POSIX.1 で認められておらず、他のシステムでは起こらない。
1272
1273 .\"O The Linux interfaces that display this behavior are:
1274 この挙動を示す Linux のインターフェイスは以下の通りである。
1275 .RS 4
1276 .IP * 2
1277 .\"O Socket interfaces, when a timeout has been set on the socket using
1278 .\"O .BR setsockopt (2):
1279 .\"O .BR accept (2),
1280 .\"O .BR recv (2),
1281 .\"O .BR recvfrom (2),
1282 .\"O and
1283 .\"O .BR recvmsg (2),
1284 .\"O if a receive timeout
1285 .\"O .RB ( SO_RCVTIMEO )
1286 .\"O has been set;
1287 .\"O .BR connect (2),
1288 .\"O .BR send (2),
1289 .\"O .BR sendto (2),
1290 .\"O and
1291 .\"O .BR sendmsg (2),
1292 .\"O if a send timeout
1293 .\"O .RB ( SO_SNDTIMEO )
1294 .\"O has been set.
1295 .BR setsockopt (2)
1296 を使ってタイムアウトが設定されているソケットインターフェース:
1297 .BR accept (2),
1298 .BR recv (2),
1299 .BR recvfrom (2),
1300 .BR recvmsg (2)
1301 で受信タイムアウト
1302 .RB ( SO_RCVTIMEO )
1303 が設定されている場合と、
1304 .BR connect (2),
1305 .BR send (2),
1306 .BR sendto (2),
1307 .BR sendmsg (2)
1308 で送信タイムアウト
1309 .RB ( SO_SNDTIMEO )
1310 が設定されている場合。
1311 .IP * 2
1312 .BR epoll_wait (2),
1313 .BR epoll_pwait (2).
1314 .IP *
1315 .BR semop (2),
1316 .BR semtimedop (2).
1317 .IP *
1318 .BR sigtimedwait (2),
1319 .BR sigwaitinfo (2).
1320 .IP *
1321 .\"O .BR read (2)
1322 .\"O from an
1323 .\"O .BR inotify (7)
1324 .\"O file descriptor.
1325 .BR inotify (7)
1326 ファイルディスクリプタからの
1327 .BR read (2).
1328 .IP *
1329 .\"O Linux 2.6.21 and earlier:
1330 Linux 2.6.21 以前:
1331 .BR futex (2)
1332 .BR FUTEX_WAIT ,
1333 .BR sem_timedwait (3),
1334 .BR sem_wait (3).
1335 .IP *
1336 .\"O Linux 2.6.8 and earlier:
1337 Linux 2.6.8 以前:
1338 .BR msgrcv (2),
1339 .BR msgsnd (2).
1340 .IP *
1341 .\"O Linux 2.4 and earlier:
1342 Linux 2.4 以前:
1343 .BR nanosleep (2).
1344 .RE
1345 .\"O .SH "CONFORMING TO"
1346 .SH 準拠
1347 .\"O POSIX.1, except as noted.
1348 POSIX.1 (注記した内容以外)。
1349 .\"O .SH BUGS
1350 .SH バグ
1351 .\"O .B SIGIO
1352 .\"O and
1353 .\"O .B SIGLOST
1354 .\"O have the same value.
1355 .\"O The latter is commented out in the kernel source, but
1356 .\"O the build process of some software still thinks that
1357 .\"O signal 29 is
1358 .\"O .BR SIGLOST .
1359 .B SIGIO
1360
1361 .B SIGLOST
1362 は同じ値を持っている。
1363 .B SIGLOST
1364 はカーネルのソースではコメントアウトされている。
1365 しかし、ソフトウェアによってはビルドの過程でシグナル 29 を
1366 .B SIGLOST
1367 とみなしてしまうものがある。
1368 .\"O .SH "SEE ALSO"
1369 .SH 関連項目
1370 .BR kill (1),
1371 .BR getrlimit (2),
1372 .BR kill (2),
1373 .BR killpg (2),
1374 .BR rt_sigqueueinfo (2),
1375 .BR setitimer (2),
1376 .BR setrlimit (2),
1377 .BR sgetmask (2),
1378 .BR sigaction (2),
1379 .BR sigaltstack (2),
1380 .BR signal (2),
1381 .BR signalfd (2),
1382 .BR sigpending (2),
1383 .BR sigprocmask (2),
1384 .BR sigsuspend (2),
1385 .BR sigwaitinfo (2),
1386 .BR abort (3),
1387 .BR bsd_signal (3),
1388 .BR longjmp (3),
1389 .BR raise (3),
1390 .BR pthread_sigqueue (3),
1391 .BR sigqueue (3),
1392 .BR sigset (3),
1393 .BR sigsetops (3),
1394 .BR sigvec (3),
1395 .BR sigwait (3),
1396 .BR strsignal (3),
1397 .BR sysv_signal (3),
1398 .BR core (5),
1399 .BR proc (5),
1400 .BR pthreads (7),
1401 .BR sigevent (7)