OSDN Git Service

(split) LDP: Translation snapshots for ja.po.
[linuxjm/LDP_man-pages.git] / draft / man2 / sigaction.2
1 '\" t
2 .\" Copyright (c) 1994,1995 Mike Battersby <mib@deakin.edu.au>
3 .\" and Copyright 2004, 2005 Michael Kerrisk <mtk.manpages@gmail.com>
4 .\" based on work by faith@cs.unc.edu
5 .\"
6 .\" Permission is granted to make and distribute verbatim copies of this
7 .\" manual provided the copyright notice and this permission notice are
8 .\" preserved on all copies.
9 .\"
10 .\" Permission is granted to copy and distribute modified versions of this
11 .\" manual under the conditions for verbatim copying, provided that the
12 .\" entire resulting derived work is distributed under the terms of a
13 .\" permission notice identical to this one.
14 .\"
15 .\" Since the Linux kernel and libraries are constantly changing, this
16 .\" manual page may be incorrect or out-of-date.  The author(s) assume no
17 .\" responsibility for errors or omissions, or for damages resulting from
18 .\" the use of the information contained herein.  The author(s) may not
19 .\" have taken the same level of care in the production of this manual,
20 .\" which is licensed free of charge, as they might when working
21 .\" professionally.
22 .\"
23 .\" Formatted or processed versions of this manual, if unaccompanied by
24 .\" the source, must acknowledge the copyright and authors of this work.
25 .\"
26 .\" Modified, aeb, 960424
27 .\" Modified Fri Jan 31 17:31:20 1997 by Eric S. Raymond <esr@thyrsus.com>
28 .\" Modified Thu Nov 26 02:12:45 1998 by aeb - add SIGCHLD stuff.
29 .\" Modified Sat May  8 17:40:19 1999 by Matthew Wilcox
30 .\"     add POSIX.1b signals
31 .\" Modified Sat Dec 29 01:44:52 2001 by Evan Jones <ejones@uwaterloo.ca>
32 .\"     SA_ONSTACK
33 .\" Modified 2004-11-11 by Michael Kerrisk <mtk.manpages@gmail.com>
34 .\"     Added mention of SIGCONT under SA_NOCLDSTOP
35 .\"     Added SA_NOCLDWAIT
36 .\" Modified 2004-11-17 by Michael Kerrisk <mtk.manpages@gmail.com>
37 .\"     Updated discussion for POSIX.1-2001 and SIGCHLD and sa_flags.
38 .\"     Formatting fixes
39 .\" 2004-12-09, mtk, added SI_TKILL + other minor changes
40 .\" 2005-09-15, mtk, split sigpending(), sigprocmask(), sigsuspend()
41 .\"     out of this page into separate pages.
42 .\"
43 .\" Japanese Version Copyright (c) 1997 HANATAKA Shinya all rights reserved.
44 .\" Translated 1997-03-03, HANATAKA Shinya <hanataka@abyss.rim.or.jp>
45 .\" Modified 2000-10-02, HANATAKA Shinya <hanataka@abyss.rim.or.jp>
46 .\" Modified 2001-10-18, Akihiro MOTOKI <amotoki@dd.iij4u.or.jp>
47 .\" Updated 2005-03-15, Akihiro MOTOKI
48 .\" Updated 2005-10-05, Akihiro MOTOKI
49 .\" Updated 2007-09-08, Akihiro MOTOKI, LDP v2.64
50 .\" Updated 2008-08-08, Akihiro MOTOKI, LDP v3.05
51 .\" Updated 2010-04-18, Akihiro MOTOKI, LDP v3.24
52 .\"
53 .\"WORD:        signal                  シグナル
54 .\"WORD:        process                 プロセス
55 .\"WORD:        signal handler          シグナルハンドラ
56 .\"WORD:        pointer                 ポインター
57 .\"WORD:        mask                    マスク
58 .\"WORD:        block                   禁止(block)
59 .\"WORD:        suspend                 停止(suspend)
60 .\"WORD:        stop                    停止(stop)
61 .\"WORD:        catch                   捕獲(catch)
62 .\"WORD:        architecture            アーキテクチャー
63 .\"WORD:        compatible              互換性
64 .\"WORD:        pottable                移植性
65 .\"
66 .TH SIGACTION 2 2009-07-25 "Linux" "Linux Programmer's Manual"
67 .\"O .SH NAME
68 .SH 名前
69 .\"O sigaction \- examine and change a signal action
70 sigaction \- シグナルの動作の確認と変更
71 .\"O .SH SYNOPSIS
72 .SH 書式
73 .nf
74 .B #include <signal.h>
75 .sp
76 .BI "int sigaction(int " signum ", const struct sigaction *" act ,
77 .BI "              struct sigaction *" oldact );
78 .fi
79 .sp
80 .in -4n
81 .\"O Feature Test Macro Requirements for glibc (see
82 .\"O .BR feature_test_macros (7)):
83 glibc 向けの機能検査マクロの要件
84 .RB ( feature_test_macros (7)
85 参照):
86 .in
87 .sp
88 .ad l
89 .BR sigaction ():
90 _POSIX_C_SOURCE\ >=\ 1 || _XOPEN_SOURCE || _POSIX_SOURCE
91 .ad b
92 .\"O .SH DESCRIPTION
93 .SH 説明
94 .\"O The
95 .\"O .BR sigaction ()
96 .\"O system call is used to change the action taken by a process on
97 .\"O receipt of a specific signal.
98 .\"O (See
99 .\"O .BR signal (7)
100 .\"O for an overview of signals.)
101 .BR sigaction ()
102 システムコールは、特定のシグナルを受信した際の
103 プロセスの動作を変更するのに使用される
104 (シグナルの概要については
105 .BR signal (7)
106 を参照)。
107 .PP
108 .\"O .I signum
109 .\"O specifies the signal and can be any valid signal except
110 .\"O .B SIGKILL
111 .\"O and
112 .\"O .BR SIGSTOP .
113 .I signum
114 には、
115 .B SIGKILL
116
117 .B SIGSTOP
118 以外の有効なシグナルをどれでも指定できる。
119 .PP
120 .\"O If
121 .\"O .I act
122 .\"O is non-NULL, the new action for signal
123 .\"O .I signum
124 .\"O is installed from
125 .\"O .IR act .
126 .I act
127 が NULL 以外であれば、シグナル
128 .I signum
129 の新しい動作 (action) として
130 .I act
131 が設定される。
132 .\"O If
133 .\"O .I oldact
134 .\"O is non-NULL, the previous action is saved in
135 .\"O .IR oldact .
136 .I oldact
137 が NULL でなければ、今までの動作が
138 .I oldact
139 に格納される。
140 .PP
141 .\"O The
142 .\"O .I sigaction
143 .\"O structure is defined as something like:
144 .I sigaction
145 構造体は以下のような感じに定義される。
146 .sp
147 .in +4n
148 .nf
149 struct sigaction {
150     void     (*sa_handler)(int);
151     void     (*sa_sigaction)(int, siginfo_t *, void *);
152     sigset_t   sa_mask;
153     int        sa_flags;
154     void     (*sa_restorer)(void);
155 };
156 .fi
157 .in
158 .PP
159 .\"O On some architectures a union is involved: do not assign to both
160 .\"O .I sa_handler
161 .\"O and
162 .\"O .IR sa_sigaction .
163 アーキテクチャによっては共用体 (union) が用いられており、その場合には
164 .I sa_handler
165
166 .I sa_sigaction
167 の両方を同時に割り当てることはできない。
168 .PP
169 .\"O The
170 .\"O .I sa_restorer
171 .\"O element is obsolete and should not be used.
172 .I sa_restorer
173 要素は廃止予定であり使用すべきではない。
174 .\"O POSIX does not specify a
175 .\"O .I sa_restorer
176 .\"O element.
177 POSIX には
178 .I sa_restorer
179 要素に関する規定はない。
180 .PP
181 .\"O .I sa_handler
182 .\"O specifies the action to be associated with
183 .\"O .I signum
184 .\"O and may be
185 .\"O .B SIG_DFL
186 .\"O for the default action,
187 .\"O .B SIG_IGN
188 .\"O to ignore this signal, or a pointer to a signal handling function.
189 .\"O This function receives the signal number as its only argument.
190 .I sa_handler
191
192 .I signum
193 に対応する動作を指定するもので、
194 デフォルトの動作を行う
195 .BR SIG_DFL 、
196 そのシグナルを無視する
197 .BR SIG_IGN 、
198 シグナルハンドラ関数へのポインタが設定できる。
199 シグナルハンドラ関数の引き数は一つであり、シグナル番号が引き数として
200 渡される。
201 .PP
202 .\"O If
203 .\"O .B SA_SIGINFO
204 .\"O is specified in
205 .\"O .IR sa_flags ,
206 .\"O then
207 .\"O .I sa_sigaction
208 .\"O (instead of
209 .\"O .IR sa_handler )
210 .\"O specifies the signal-handling function for
211 .\"O .IR signum .
212 .\"O This function receives the signal number as its first argument, a
213 .\"O pointer to a
214 .\"O .I siginfo_t
215 .\"O as its second argument and a pointer to a
216 .\"O .I ucontext_t
217 .\"O (cast to \fIvoid\ *\fP) as its third argument.
218 .I sa_flags
219
220 .B SA_SIGINFO
221 が指定された場合、
222 .RI ( sa_handler
223 ではなく)
224 .I sa_sigaction
225 により
226 .I signum
227 に対応するシグナルハンドル関数が指定される。
228 指定される関数は、最初の引き数としてシグナル番号を、
229 二番目の引き数として
230 .I siginfo_t
231 へのポインタを、三番目の引き数として (\fIvoid\ *\fP にキャストした)
232 .I ucontext_t
233 へのポインタを受けとる。
234 .PP
235 .\"O .I sa_mask
236 .\"O specifies a mask of signals which should be blocked
237 .\"O (i.e., added to the signal mask of the thread in which
238 .\"O the signal handler is invoked)
239 .\"O during execution of the signal handler.
240 .\"O In addition, the signal which triggered the handler
241 .\"O will be blocked, unless the
242 .\"O .B SA_NODEFER
243 .\"O flag is used.
244 .I sa_mask
245 は、シグナル・ハンドラ実行中に禁止 (block) すべきシグナルのマスクを指定する
246 (ハンドラ実行中のシグナルの禁止は、シグナル・ハンドラが起動されたスレッド
247 のシグナルのマスクに追加することで行われる)。
248 さらに、
249 .B SA_NODEFER
250 フラグが指定されていない場合は、ハンドラを起動するきっかけとなる
251 シグナルにも
252 .I sa_mask
253 が適用される。
254 .PP
255 .\"O .I sa_flags
256 .\"O specifies a set of flags which modify the behavior of the signal.
257 .\"O It is formed by the bitwise OR of zero or more of the following:
258 .I sa_flags
259 はシグナル・ハンドラの動作を変更するためのフラグの集合を指定する。
260 .I sa_flags
261 には、以下に示すフラグの (0 個以上の) 論理和をとったものを指定する。
262 .RS 4
263 .TP
264 .B SA_NOCLDSTOP
265 .\"O If
266 .\"O .I signum
267 .\"O is
268 .\"O .BR SIGCHLD ,
269 .\"O do not receive notification when child processes stop (i.e., when they
270 .\"O receive one of
271 .\"O .BR SIGSTOP ", " SIGTSTP ", " SIGTTIN
272 .\"O or
273 .\"O .BR SIGTTOU )
274 .\"O or resume (i.e., they receive
275 .\"O .BR SIGCONT )
276 .\"O (see
277 .\"O .BR wait (2)).
278 .\"O This flag is only meaningful when establishing a handler for
279 .\"O .BR SIGCHLD .
280 .I signum
281
282 .B SIGCHLD
283 の場合、
284 子プロセスが停止したり
285 (子プロセスが
286 .BR SIGSTOP ", " SIGTSTP ", " SIGTTIN ", " SIGTTOU
287 を受けたとき) 再開したり (子プロセスが
288 .B SIGCONT
289 を受けたとき) したときに
290 .B SIGCHLD
291 の通知を受けない。
292 このフラグは、
293 .B SIGCHLD
294 に対してハンドラを設定する際にのみ意味を持つ。
295 .TP
296 .\"O .BR SA_NOCLDWAIT " (Since Linux 2.6)"
297 .BR SA_NOCLDWAIT " (Linux 2.6 以降)"
298 .\"O .\" To be precise: Linux 2.5.60 -- MTK
299 (Linux 2.6 以降)
300 .\" 正確には Linux 2.5.60 以降 -- MTK
301 .\"O If
302 .\"O .I signum
303 .\"O is
304 .\"O .BR SIGCHLD ,
305 .\"O do not transform children into zombies when they terminate.
306 .\"O See also
307 .\"O .BR waitpid (2).
308 .I signum
309
310 .B SIGCHLD
311 の場合、子プロセスが終了したときに
312 子プロセスをゾンビプロセスに変化させない
313 .RB ( waitpid (2)
314 も参照)。
315 .\"O This flag is only meaningful when establishing a handler for
316 .\"O .BR SIGCHLD ,
317 .\"O or when setting that signal's disposition to
318 .\"O .BR SIG_DFL .
319 このフラグは、
320 .B SIGCHLD
321 に対してハンドラを設定する際、もしくはそのシグナルの処理方法を
322 .B SIG_DFL
323 に設定する際にのみ意味を持つ。
324
325 .\"O If the
326 .\"O .B SA_NOCLDWAIT
327 .\"O flag is set when establishing a handler for
328 .\"O .BR SIGCHLD ,
329 .\"O POSIX.1 leaves it unspecified whether a
330 .\"O .B SIGCHLD
331 .\"O signal is generated when a child process terminates.
332 .\"O On Linux, a
333 .\"O .B SIGCHLD
334 .\"O signal is generated in this case;
335 .\"O on some other implementations, it is not.
336 .BR SIGCHLD
337 に対してハンドラを設定する際に
338 .B SA_NOCLDWAIT
339 フラグをセットした場合、
340 子プロセスが終了した際に
341 .B SIGCHLD
342 シグナルが生成されるかどうかは、
343 POSIX.1 では規定されていない。
344 Linux では、この状況で
345 .B SIGCHLD
346 シグナルは生成される。
347 いくつかの他の実装では生成されない。
348 .TP
349 .B SA_NODEFER
350 .\"O Do not prevent the signal from being received from within its own signal
351 .\"O handler.
352 .\"O This flag is only meaningful when establishing a signal handler.
353 .\"O .B SA_NOMASK
354 .\"O is an obsolete, nonstandard synonym for this flag.
355 それ自身のシグナル・ハンドラーの内部にいる時でも
356 そのシグナルをマスクしないようにする。
357 このフラグはシグナルハンドラを設定する際にのみ意味を持つ。
358 .B SA_NOMASK
359 はこのフラグと同じ意味だが、廃止されており、非標準である。
360 .TP
361 .B SA_ONSTACK
362 .\"O Call the signal handler on an alternate signal stack provided by
363 .\"O .BR sigaltstack (2).
364 .\"O If an alternate stack is not available, the default stack will be used.
365 .\"O This flag is only meaningful when establishing a signal handler.
366 .BR sigaltstack (2)
367 で提供される別のシグナル・スタックでシグナルハンドラを呼び出す。
368 別のシグナル・スタックが利用可能でなければ、デフォルトのスタックが
369 使用される。
370 このフラグはシグナルハンドラを設定する際にのみ意味を持つ。
371 .TP
372 .BR SA_RESETHAND
373 .\"O Restore the signal action to the default state once the signal handler
374 .\"O has been called.
375 .\"O This flag is only meaningful when establishing a signal handler.
376 .\"O .B SA_ONESHOT
377 .\"O is an obsolete, nonstandard synonym for this flag.
378 シグナルハンドラが呼ばれる度に、シグナルの動作をデフォルトに戻す。
379 このフラグはシグナルハンドラを設定する際にのみ意味を持つ。
380 .B SA_ONESHOT
381 はこのフラグと同じ意味だが、廃止されており、非標準である。
382 .TP
383 .B SA_RESTART
384 .\"O Provide behavior compatible with BSD signal semantics by making certain
385 .\"O system calls restartable across signals.
386 .\"O This flag is only meaningful when establishing a signal handler.
387 .\"O See
388 .\"O .BR signal (7)
389 .\"O for a discussion of system call restarting.
390 いくつかのシステムコールをシグナルの通知の前後で再開できるようにして、
391 BSD シグナル方式 (semantics) と互換性のある動作を提供する。
392 このフラグはシグナルハンドラを設定する際にのみ意味を持つ。
393 .BR signal (7)
394 に書かれているシステムコールの再開に関する議論を参照のこと。
395 .TP
396 .\"O .BR SA_SIGINFO " (since Linux 2.2)"
397 .BR SA_SIGINFO " (Linux 2.2 以降)"
398 .\"O The signal handler takes 3 arguments, not one.
399 .\"O In this case,
400 .\"O .I sa_sigaction
401 .\"O should be set instead of
402 .\"O .IR sa_handler .
403 .\"O This flag is only meaningful when establishing a signal handler.
404 .\"O .\" (The
405 .\"O .\" .I sa_sigaction
406 .\"O .\" field was added in Linux 2.1.86.)
407 シグナルハンドラは一つではなく、三つの引き数を持つ。この場合は
408 .I sa_handler
409 のかわりに
410 .I sa_sigaction
411 を設定しなければならない
412 このフラグはシグナルハンドラを設定する際にのみ意味を持つ。
413 .\" .RI ( sa_sigaction
414 .\" フィールドは Linux 2.1.86 で追加された)。
415 .RE
416 .PP
417 .\"O The
418 .\"O .I siginfo_t
419 .\"O argument to
420 .\"O .I sa_sigaction
421 .\"O is a struct with the following elements:
422 .I sa_sigaction
423 のパラメータ
424 .I siginfo_t
425 は以下の要素を持つ構造体である:
426 .sp
427 .in +4n
428 .nf
429 siginfo_t {
430     int      si_signo;    /* Signal number */
431     int      si_errno;    /* An errno value */
432     int      si_code;     /* Signal code */
433     int      si_trapno;   /* Trap number that caused
434                              hardware-generated signal
435                              (unused on most architectures) */
436 .\" FIXME
437 .\" si_trapno seems to be only used on SPARC and Alpha;
438 .\" this page could use a little more detail on its purpose there.
439     pid_t    si_pid;      /* Sending process ID */
440     uid_t    si_uid;      /* Real user ID of sending process */
441     int      si_status;   /* Exit value or signal */
442     clock_t  si_utime;    /* User time consumed */
443     clock_t  si_stime;    /* System time consumed */
444     sigval_t si_value;    /* Signal value */
445     int      si_int;      /* POSIX.1b signal */
446     void    *si_ptr;      /* POSIX.1b signal */
447     int      si_overrun;  /* Timer overrun count; POSIX.1b timers */
448     int      si_timerid;  /* Timer ID; POSIX.1b timers */
449 .\" In the kernel: si_tid
450     void    *si_addr;     /* Memory location which caused fault */
451     int      si_band;     /* Band event */
452     int      si_fd;       /* File descriptor */
453 }
454 .fi
455 .in
456
457 .\"O .IR si_signo ", " si_errno " and " si_code
458 .\"O are defined for all signals.
459 .\"O .RI ( si_errno
460 .\"O is generally unused on Linux.)
461 .IR si_signo ", " si_errno ", " si_code
462 は全てのシグナルに対して定義されている
463 .RI ( si_errno
464 は Linux では一般的には使用されない)。
465 .\"O The rest of the struct may be a union, so that one should only
466 .\"O read the fields that are meaningful for the given signal:
467 構造体の残りの部分は、共用体 (union) になっているかもしれない。
468 その場合は該当するシグナルにおいて意味のあるフィールドのみを読み込む
469 ことができる。
470 .IP * 2
471 .\"O POSIX.1b signals and
472 .\"O .B SIGCHLD
473 .\"O fill in
474 .\"O .IR si_pid " and " si_uid .
475 POSIX.1b シグナルと
476 .B SIGCHLD
477
478 .IR si_pid " と " si_uid
479 を設定する。
480 .IP *
481 .\"O POSIX.1b timers (since Linux 2.6) fill in
482 .\"O .I si_overrun
483 .\"O and
484 .\"O .IR si_timerid .
485 .\"O The
486 .\"O .I si_timerid
487 .\"O field is an internal ID used by the kernel to identify
488 .\"O the timer; it is not the same as the timer ID returned by
489 .\"O .BR timer_create (2).
490 POSIX.1b タイマ (Linux 2.6 以降) は
491 .I si_overrun
492
493 .I si_timerid
494 を設定する。
495 .I si_timerid
496 フィールドはカーネルがタイマを特定するのに使用する内部 ID であり、
497 .BR timer_create (2)
498 が返すタイマ ID と同じではない。
499 .IP *
500 .\"O .B SIGCHLD
501 .\"O fills in
502 .\"O .IR si_status ", " si_utime " and " si_stime .
503 .B SIGCHLD
504
505 .IR si_status ", " si_utime ", " si_stime
506 を設定する。
507 .\"O The
508 .\"O .I si_utime
509 .\"O and
510 .\"O .I si_stime
511 .\"O fields do not include the times used by waited-for children (unlike
512 .\"O .BR getrusage (2)
513 .\"O and
514 .\"O .BR time (2)).
515 .\"O In kernels up to 2.6, and since 2.6.27, these fields report
516 .\"O CPU time in units of
517 .\"O .IR sysconf(_SC_CLK_TCK) .
518 .\"O In 2.6 kernels before 2.6.27,
519 .\"O a bug meant that these fields reported time in units
520 .\"O of the (configurable) system jiffy (see
521 .\"O .BR time (7)).
522 .RB ( getrusage (2)
523
524 .BR time (2)
525 と異なり) フィールド
526 .I si_utime
527
528 .I si_stime
529 には wait 待ちの子プロセスにより使用された時間は含まれない。
530 2.6 より前と 2.6.27 以降のカーネルでは、
531 これらのフィールドに格納される CPU 時間の単位は
532 .I sysconf(_SC_CLK_TCK)
533 である。
534 2.6.27 より前の 2.6 系のカーネルでは、バグがあり、
535 これらのフィールドの CPU 時間の単位が
536 (カーネルのコンフィグで指定される) システムの jiffy であった
537 .RB ( time (7)
538 参照)。
539 .\" FIXME .
540 .\" When si_utime and si_stime where originally implemented, the
541 .\" measurement unit was HZ, which was the same as clock ticks
542 .\" (sysconf(_SC_CLK_TCK)).  In 2.6, HZ became configurable, and
543 .\" was *still* used as the unit to return the info these fields,
544 .\" with the result that the field values depended on the the
545 .\" configured HZ.  Of course, the should have been measured in
546 .\" USER_HZ instead, so that sysconf(_SC_CLK_TCK) could be used to
547 .\" convert to seconds.  I have a queued patch to fix this:
548 .\" http://thread.gmane.org/gmane.linux.kernel/698061/ .
549 .\" This patch made it into 2.6.27.
550 .\" But note that these fields still don't return the times of
551 .\" waited-for children (as is done by getrusage() and times()
552 .\" and wait4()).  Solaris 8 does include child times.
553 .IP *
554 .\"O .IR si_int " and " si_ptr
555 .\"O are specified by the sender of the POSIX.1b signal.
556 .IR si_int " と " si_ptr
557 は POSIX.1b シグナルの送信者によって指定される。
558 .\"O See
559 .\"O .BR sigqueue (2)
560 .\"O for more details.
561 詳細は
562 .BR sigqueue (2)
563 を参照のこと。
564 .IP *
565 .\"O .BR SIGILL ,
566 .\"O .BR SIGFPE ,
567 .\"O .BR SIGSEGV ,
568 .\"O and
569 .\"O .B SIGBUS
570 .\"O fill in
571 .\"O .I si_addr
572 .\"O with the address of the fault.
573 .BR SIGILL ,
574 .BR SIGFPE ,
575 .BR SIGSEGV ,
576 .B SIGBUS
577
578 .I si_addr
579 にエラーが発生したアドレスを設定する。
580 .\"O .B SIGPOLL
581 .\"O fills in
582 .\"O .IR si_band " and " si_fd .
583 SIGPOLL は
584 .IR si_band " と " si_fd
585 を設定する。
586 .PP
587 .\"O .I si_code
588 .\"O is a value (not a bit mask)
589 .\"O indicating why this signal was sent.
590 .I si_code
591 は、そのシグナルが送信された理由を示す値である (ビットマスクではない)。
592 .\"O The following list shows the values which can be placed in
593 .\"O .I si_code
594 .\"O for any signal, along with reason that the signal was generated.
595 以下のリストに、どのシグナルの場合でも
596 .I si_code
597 に入りうる値を、シグナルが生成された理由とともに記載する。
598 .RS 4
599 .TP 15
600 .B SI_USER
601 .\"O .BR kill (2)
602 .\"O or
603 .\"O .BR raise (3)
604 .BR kill (2)
605 または
606 .BR raise (3)
607 .TP
608 .B SI_KERNEL
609 .\"O Sent by the kernel.
610 カーネルにより送信された
611 .TP
612 .B SI_QUEUE
613 .BR sigqueue (2)
614 .TP
615 .B SI_TIMER
616 .\"O POSIX timer expired
617 POSIX タイマが満了した
618 .TP
619 .B SI_MESGQ
620 .\"O POSIX message queue state changed (since Linux 2.6.6); see
621 .\"O .BR mq_notify (3)
622 POSIX メッセージキューの状態が変化した (Linux 2.6.6 以降)。
623 .BR mq_notify (3) 参照。
624 .TP
625 .B SI_ASYNCIO
626 .\"O AIO completed
627 非同期 IO (AIO) が完了した
628 .TP
629 .B SI_SIGIO
630 .\"O queued SIGIO
631 キューイングされた SIGIO
632 .TP
633 .B SI_TKILL
634 .\"O .BR tkill (2)
635 .\"O or
636 .\"O .BR tgkill (2)
637 .\"O (since Linux 2.4.19)
638 .BR tkill (2)
639 または
640 .BR tgkill (2)
641 (Linux 2.4.19 以降)
642 .\" SI_DETHREAD is defined in 2.6.9 sources, but isn't implemented
643 .\" It appears to have been an idea that was tried during 2.5.6
644 .\" through to 2.5.24 and then was backed out.
645 .RE
646 .PP
647 .\"O The following values can be placed in
648 .\"O .I si_code
649 .\"O for a
650 .\"O .B SIGILL
651 .\"O signal:
652 .B SIGILL
653 シグナルの場合、
654 .I si_code
655 には以下の値を指定できる:
656 .RS 4
657 .TP 15
658 .B ILL_ILLOPC
659 .\"O illegal opcode
660 不正な命令コード (opcode)
661 .TP
662 .B ILL_ILLOPN
663 .\"O illegal operand
664 不正なオペランド
665 .TP
666 .B ILL_ILLADR
667 .\"O illegal addressing mode
668 不正なアドレッシングモード
669 .TP
670 .B ILL_ILLTRP
671 .\"O illegal trap
672 不正なトラップ
673 .TP
674 .B ILL_PRVOPC
675 .\"O privileged opcode
676 特権が必要な命令コード (opcode)
677 .TP
678 .B ILL_PRVREG
679 .\"O privileged register
680 特権が必要なレジスタ
681 .TP
682 .B ILL_COPROC
683 .\"O coprocessor error
684 コプロセッサのエラー
685 .TP
686 .B ILL_BADSTK
687 .\"O internal stack error
688 内部スタックエラー
689 .RE
690 .PP
691 .\"O The following values can be placed in
692 .\"O .I si_code
693 .\"O for a
694 .\"O .B SIGFPE
695 .\"O signal:
696 .B SIGFPE
697 シグナルの場合、
698 .I si_code
699 には以下の値を指定できる:
700 .RS 4
701 .TP 15
702 .B FPE_INTDIV
703 .\"O integer divide by zero
704 整数の 0 による除算
705 .TP
706 .B FPE_INTOVF
707 .\"O integer overflow
708 整数のオーバーフロー
709 .TP
710 .B FPE_FLTDIV
711 .\"O floating-point divide by zero
712 浮動小数点の 0 による除算
713 .TP
714 .B FPE_FLTOVF
715 .\"O floating-point overflow
716 浮動小数点のオーバーフロー
717 .TP
718 .B FPE_FLTUND
719 .\"O floating-point underflow
720 浮動小数点のアンダーフロー
721 .TP
722 .B FPE_FLTRES
723 .\"O floating-point inexact result
724 浮動小数点の不正確な演算結果 (inexact result)
725 .TP
726 .B FPE_FLTINV
727 .\"O floating-point invalid operation
728 浮動小数点の不正な操作
729 .TP
730 .B FPE_FLTSUB
731 .\"O subscript out of range
732 範囲外の添字 (subscript)
733 .RE
734 .PP
735 .\"O The following values can be placed in
736 .\"O .I si_code
737 .\"O for a
738 .\"O .B SIGSEGV
739 .\"O signal:
740 .B SIGSEGV
741 シグナルの場合、
742 .I si_code
743 には以下の値を指定できる:
744 .RS 4
745 .TP 15
746 .B SEGV_MAPERR
747 .\"O address not mapped to object
748 オブジェクトにマッピングされていないアドレス
749 .TP
750 .B SEGV_ACCERR
751 .\"O invalid permissions for mapped object
752 マッピングされたオブジェクトに対するアクセス許可がない
753 .RE
754 .PP
755 .\"O The following values can be placed in
756 .\"O .I si_code
757 .\"O for a
758 .\"O .B SIGBUS
759 .\"O signal:
760 .B SIGBUS
761 シグナルの場合、
762 .I si_code
763 には以下の値を指定できる:
764 .RS 4
765 .TP 15
766 .B BUS_ADRALN
767 .\"O invalid address alignment
768 不正なアドレス・アライメント (alignment)
769 .TP
770 .B BUS_ADRERR
771 .\"O nonexistent physical address
772 存在しない物理アドレス
773 .TP
774 .B BUS_OBJERR
775 .\"O object-specific hardware error
776 オブジェクト固有のハードウェアエラー
777 .RE
778 .PP
779 .\"O The following values can be placed in
780 .\"O .I si_code
781 .\"O for a
782 .\"O .B SIGTRAP
783 .\"O signal:
784 .B SIGTRAP
785 シグナルの場合、
786 .I si_code
787 には以下の値を指定できる:
788 .RS 4
789 .TP 15
790 .B TRAP_BRKPT
791 .\"O process breakpoint
792 プロセスのブレークポイント
793 .TP
794 .B TRAP_TRACE
795 .\"O process trace trap
796 プロセスのトレース・トラップ
797 .RE
798 .PP
799 .\"O The following values can be placed in
800 .\"O .I si_code
801 .\"O for a
802 .\"O .B SIGCHLD
803 .\"O signal:
804 .B SIGCHLD
805 シグナルの場合、
806 .I si_code
807 には以下の値を指定できる:
808 .RS 4
809 .TP 15
810 .B CLD_EXITED
811 .\"O child has exited
812 子プロセスが終了した (exited)
813 .TP
814 .B CLD_KILLED
815 .\"O child was killed
816 子プロセスが kill された
817 .TP
818 .B CLD_DUMPED
819 .\"O child terminated abnormally
820 子プロセスが異常終了した
821 .TP
822 .B CLD_TRAPPED
823 .\"O traced child has trapped
824 トレース対象の子プロセスがトラップを上げた
825 .TP
826 .B CLD_STOPPED
827 .\"O child has stopped
828 子プロセスが停止 (stop) した
829 .TP
830 .B CLD_CONTINUED
831 .\"O stopped child has continued (since Linux 2.6.9)
832 停止していた子プロセスが再開した (Linux 2.6.9 以降)
833 .RE
834 .PP
835 .\"O The following values can be placed in
836 .\"O .I si_code
837 .\"O for a
838 .\"O .B SIGPOLL
839 .\"O signal:
840 .B SIGPOLL
841 シグナルの場合、
842 .I si_code
843 には以下の値を指定できる:
844 .RS 4
845 .TP 15
846 .B POLL_IN
847 .\"O data input available
848 入力データが利用可能
849 .TP
850 .B POLL_OUT
851 .\"O output buffers available
852 出力バッファが利用可能
853 .TP
854 .B POLL_MSG
855 .\"O input message available
856 入力メッセージが利用可能
857 .TP
858 .B POLL_ERR
859 .\"O i/o error
860 I/O エラー
861 .TP
862 .B POLL_PRI
863 .\"O high priority input available
864 高優先の入力が利用可能
865 .TP
866 .B POLL_HUP
867 .\"O device disconnected
868 デバイスが接続されていない
869 .RE
870 .\"O .SH "RETURN VALUE"
871 .SH 返り値
872 .\"O .BR sigaction ()
873 .\"O returns 0 on success and \-1 on error.
874 .BR sigaction ()
875 は成功すれば 0 を返し、エラーならば \-1 を返す。
876 .\"O .SH ERRORS
877 .SH エラー
878 .TP
879 .B EFAULT
880 .\"O .IR act " or " oldact
881 .\"O points to memory which is not a valid part of the process address space.
882 .IR act " か " oldact
883 が指しているメモリが正しいプロセスのアドレス空間にない。
884 .TP
885 .B EINVAL
886 .\"O An invalid signal was specified.
887 .\"O This will also be generated if an attempt
888 .\"O is made to change the action for
889 .\"O .BR SIGKILL " or " SIGSTOP ", "
890 .\"O which cannot be caught or ignored.
891 無効なシグナルが指定された。補足 (catch) したり無視したりできない
892 シグナルである
893 .BR SIGKILL " や " SIGSTOP
894 に対する動作を変更しようとした場合にも発生する。
895 .\"O .SH "CONFORMING TO"
896 .SH 準拠
897 POSIX.1-2001, SVr4.
898 .\"O .\" SVr4 does not document the EINTR condition.
899 .\" SVr4 には EINTR についての記述はない。
900 .\"O .SH NOTES
901 .SH 注意
902 .\"O A child created via
903 .\"O .BR fork (2)
904 .\"O inherits a copy of its parent's signal dispositions.
905 .\"O During an
906 .\"O .BR execve (2),
907 .\"O the dispositions of handled signals are reset to the default;
908 .\"O the dispositions of ignored signals are left unchanged.
909 .BR fork (2)
910 経由で作成された子プロセスは、親プロセスのシグナルの処理方法の
911 コピーを継承する。
912 .BR execve (2)
913 の前後で、ハンドラが設定されているシグナルの処理方法はデフォルトにリセットされ、
914 無視が設定されているシグナルの処理方法は変更されずそのままとなる。
915
916 .\"O According to POSIX, the behavior of a process is undefined after it
917 .\"O ignores a
918 .\"O .BR SIGFPE ,
919 .\"O .BR SIGILL ,
920 .\"O or
921 .\"O .B SIGSEGV
922 .\"O signal that was not generated by
923 .\"O .BR kill (2)
924 .\"O or
925 .\"O .BR raise (3).
926 .\"O Integer division by zero has undefined result.
927 .\"O On some architectures it will generate a
928 .\"O .B SIGFPE
929 .\"O signal.
930 .\"O (Also dividing the most negative integer by \-1 may generate
931 .\"O .BR SIGFPE .)
932 .\"O Ignoring this signal might lead to an endless loop.
933 POSIX では、
934 .BR kill (2)
935
936 .BR raise (3)
937 関数で生成できないシグナル
938 .BR SIGFPE ,
939 .BR SIGILL ,
940 .B SIGSEGV
941 を無視 (ignore) した場合、その後の動作は未定義である。
942 ゼロによる整数割り算の結果は未定義となる。
943 アーキテクチャーによっては、このとき
944 .B SIGFPE
945 シグナルが生成される。
946 (同様に負の最大整数を \-1 で割ると
947 .B SIGFPE
948 が生成されるかもしれない)
949 このシグナルを無視すると無限ループに陥るかもしれない。
950 .PP
951 .\"O POSIX.1-1990 disallowed setting the action for
952 .\"O .B SIGCHLD
953 .\"O to
954 .\"O .BR SIG_IGN .
955 .\"O POSIX.1-2001 allows this possibility, so that ignoring
956 .\"O .B SIGCHLD
957 .\"O can be used to prevent the creation of zombies (see
958 .\"O .BR wait (2)).
959 .\"O Nevertheless, the historical BSD and System V behaviors for ignoring
960 .\"O .B SIGCHLD
961 .\"O differ, so that the only completely portable method of ensuring that
962 .\"O terminated children do not become zombies is to catch the
963 .\"O .B SIGCHLD
964 .\"O signal and perform a
965 .\"O .BR wait (2)
966 .\"O or similar.
967 POSIX.1-1990 では
968 .B SIGCHLD
969
970 .B SIG_IGN
971 を設定することを認めていない。
972 POSIX.1-2001 では認められており、
973 .B SIGCHLD
974 を無視することでゾンビプロセスの生成を防止することができる
975 .RB ( wait (2)
976 を参照)。
977 さらに、BSD と SystemV では
978 .B SIGCHLD
979 を無視した際の動作が異なっている。
980 そのため、完全に移植性がある方法で、終了した子プロセスがゾンビにならないこと
981 を保証するには、
982 .B SIGCHLD
983 シグナルを補足し、
984 .BR wait (2)
985 などを実行するしかない。
986 .PP
987 .\"O POSIX.1-1990 only specified
988 .\"O .BR SA_NOCLDSTOP .
989 .\"O POSIX.1-2001 added
990 .\"O .BR SA_NOCLDWAIT ,
991 .\"O .BR SA_RESETHAND ,
992 .\"O .BR SA_NODEFER ,
993 .\"O and
994 .\"O .BR SA_SIGINFO .
995 .\"O Use of these latter values in
996 .\"O .I sa_flags
997 .\"O may be less portable in applications intended for older
998 .\"O Unix implementations.
999 POSIX.1-1990 の仕様では
1000 .B SA_NOCLDSTOP
1001 のみが定義されている。
1002 POSIX.1-2001 では
1003 .BR SA_NOCLDWAIT ,
1004 .BR SA_RESETHAND ,
1005 .BR SA_NODEFER ,
1006 .B SA_SIGINFO
1007 が追加された。
1008 Unix の古い実装で動かすアプリケーションで、
1009 他の
1010 .I sa_flags
1011 フラグを使用すると移植性が下がる。
1012 .PP
1013 .\"O The
1014 .\"O .B SA_RESETHAND
1015 .\"O flag is compatible with the SVr4 flag of the same name.
1016 .B SA_RESETHAND
1017 フラグは SVr4 の同じ名前のフラグと互換性がある。
1018 .PP
1019 .\"O The
1020 .\"O .B SA_NODEFER
1021 .\"O flag is compatible with the SVr4 flag of the same name under kernels
1022 .\"O 1.3.9 and newer.
1023 .\"O On older kernels the Linux implementation
1024 .\"O allowed the receipt of any signal, not just the one we are installing
1025 .\"O (effectively overriding any
1026 .\"O .I sa_mask
1027 .\"O settings).
1028 .B SA_NODEFER
1029 フラグは 1.3.9 以降のカーネルでは同じ名前の SVr4 のフラグと互換性がある。
1030 ぞれ以前の Linux カーネルの実装では、このフラグを設定しているシグナル
1031 だけでなく、どのシグナルでも受けることを許していた (実際には
1032 .I sa_mask
1033 の設定により無効にできる)。
1034 .PP
1035 .\"O .BR sigaction ()
1036 .\"O can be called with a null second argument to query the current signal
1037 .\"O handler.
1038 .\"O It can also be used to check whether a given signal is valid for
1039 .\"O the current machine by calling it with null second and third arguments.
1040 .BR sigaction ()
1041 の二番目の引き数に NULL を指定して呼び出すと、現在のシグナルハンドラを確認する
1042 ことができる。また、二番目と三番目の引き数を NULL にて呼び出すことで、
1043 指定されたシグナルが現在のマシンで使えるかどうかチェックできる。
1044 .PP
1045 .\"O It is not possible to block
1046 .\"O .BR SIGKILL " or " SIGSTOP
1047 .\"O (by specifying them in
1048 .\"O .IR sa_mask ).
1049 .\"O Attempts to do so are silently ignored.
1050 .B SIGKILL
1051
1052 .B SIGSTOP
1053
1054 .RI ( sa_mask
1055 に指定して) 禁止することはできない。
1056 禁止しようとしても黙って無視される。
1057 .PP
1058 .\"O See
1059 .\"O .BR sigsetops (3)
1060 .\"O for details on manipulating signal sets.
1061 シグナル集合の操作に関する詳細は
1062 .BR sigsetops (3)
1063 を参照すること。
1064 .PP
1065 .\"O See
1066 .\"O .BR signal (7)
1067 .\"O for a list of the async-signal-safe functions that can be
1068 .\"O safely called inside from inside a signal handler.
1069 シグナルハンドラ内から安全に呼び出すことができる、
1070 async-signal-safe functions (非同期シングルで安全な関数) の
1071 リストについては
1072 .BR signal (7)
1073 を参照。
1074 .\"O .SS Undocumented
1075 .SS 非公式
1076 .\"O Before the introduction of
1077 .\"O .B SA_SIGINFO
1078 .\"O it was also possible to get some additional information,
1079 .\"O namely by using a
1080 .\"O .I sa_handler
1081 .\"O with second argument of type
1082 .\"O .IR "struct sigcontext".
1083 .\"O See the relevant kernel sources for details.
1084 .\"O This use is obsolete now.
1085 .B SA_SIGINFO
1086 が導入される前は、
1087 .I "struct sigcontext"
1088 型の二番目の引き数と一緒に
1089 .I sa_handler
1090 を使用することで、
1091 いくつかの追加の情報を入手することができた。
1092 詳細についてはカーネルソースの関連部分を見てほしい。
1093 現在はこの使用法は廃止されている。
1094 .\"O .SH BUGS
1095 .SH バグ
1096 .\"O In kernels up to and including 2.6.13, specifying
1097 .\"O .B SA_NODEFER
1098 .\"O in
1099 .\"O .I sa_flags
1100 .\"O prevents not only the delivered signal from being masked during
1101 .\"O execution of the handler, but also the signals specified in
1102 .\"O .IR sa_mask .
1103 .\"O This bug was fixed in kernel 2.6.14.
1104 2.6.13 以前のカーネルでは、
1105 .I sa_flags
1106
1107 .B SA_NODEFER
1108 を指定した場合、
1109 ハンドラが実行中に配送されたシグナル自身がマスクされなくなるだけでなく、
1110 .I sa_mask
1111 に指定されたシグナルもマスクされなくなる。
1112 このバグは、カーネル 2.6.14 で修正された。
1113 .\"O .SH EXAMPLE
1114 .SH 例
1115 .\"O See
1116 .\"O .BR mprotect (2).
1117 .BR mprotect (2)
1118 参照。
1119 .\"O .SH "SEE ALSO"
1120 .SH 関連項目
1121 .BR kill (1),
1122 .BR kill (2),
1123 .BR killpg (2),
1124 .BR pause (2),
1125 .BR sigaltstack (2),
1126 .BR signal (2),
1127 .BR signalfd (2),
1128 .BR sigpending (2),
1129 .BR sigprocmask (2),
1130 .BR sigqueue (2),
1131 .BR sigsuspend (2),
1132 .BR wait (2),
1133 .BR raise (3),
1134 .BR siginterrupt (3),
1135 .BR sigsetops (3),
1136 .BR sigvec (3),
1137 .BR core (5),
1138 .BR signal (7)