OSDN Git Service

(split) LDP: Update draft and release pages (based on the previous commit)
[linuxjm/LDP_man-pages.git] / release / man2 / sigwaitinfo.2
1 .\" Copyright (c) 2002 Michael Kerrisk <mtk.manpages@gmail.com>
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 .\"*******************************************************************
26 .\"
27 .\" This file was generated with po4a. Translate the source file.
28 .\"
29 .\"*******************************************************************
30 .TH SIGWAITINFO 2 2012\-07\-21 Linux "Linux Programmer's Manual"
31 .SH 名前
32 sigwaitinfo, sigtimedwait \- キューに入れられたシグナルを同期して待つ
33 .SH 書式
34 .nf
35 \fB#include <signal.h>\fP
36 .sp
37 \fBint sigwaitinfo(const sigset_t *\fP\fIset\fP\fB, siginfo_t *\fP\fIinfo\fP\fB);\fP
38 .sp
39 \fBint sigtimedwait(const sigset_t *\fP\fIset\fP\fB, siginfo_t *\fP\fIinfo\fP\fB, \fP
40 \fB                 const struct timespec *\fP\fItimeout\fP\fB);\fP
41 .fi
42 .sp
43 .in -4n
44 glibc 向けの機能検査マクロの要件 (\fBfeature_test_macros\fP(7)  参照):
45 .in
46 .sp
47 \fBsigwaitinfo\fP(), \fBsigtimedwait\fP(): _POSIX_C_SOURCE\ >=\ 199309L
48 .SH 説明
49 \fBsigwaitinfo\fP()  は \fIset\fP のうちのどれかのシグナルが処理待ちになるまで、 呼び出しスレッドの実行を一時停止する
50 (呼び出しスレッドに対して \fIset\fP のうちのどれかのシグナルが既に待機中 (pending) である場合、 \fBsigwaitinfo\fP()
51 はすぐに戻る)。
52
53 \fBsigwaitinfo\fP()  はそのシグナルを待機中のシグナルの集合から削除し、関数の結果としてシグナル番号を返す。 \fIinfo\fP 引き数が
54 NULL でない場合、配送されたシグナルの情報が入った \fIsiginfo_t\fP 型 (\fBsigaction\fP(2)  を参照) の構造体を
55 \fIinfo\fP が指すバッファに入れて返す。
56 .PP
57 If multiple signals in \fIset\fP are pending for the caller, the signal that is
58 retrieved by \fBsigwaitinfo\fP()  is determined according to the usual ordering
59 rules; see \fBsignal\fP(7)  for further details.
60 .PP
61 \fBsigtimedwait\fP() は、 \fBsigwaitinfo\fP() と次の点を除いて全く同じように
62 動作する。この関数にはもう 1 つの引き数 \fItimeout\fP があり、シグナル待ち
63 でスレッドが一時停止する最小時間を指定することができる(この時間はシステ
64 ムクロックの粒度に切り上げられ、カーネルのスケジューリング遅延により
65 少しだけ長くなる可能性がある)。この引き数の型は以下のとおりである:
66 .sp
67 .in +4n
68 .nf
69 struct timespec {
70     long    tv_sec;         /* 秒 */
71     long    tv_nsec;        /* ナノ秒 */
72 }
73 .fi
74 .in
75 .sp
76 この構造体の 2 つのフィールドがともに 0 の場合、ポーリングが行われる: \fBsigtimedwait\fP()  は、呼び出し側プロセスに対して
77 待機しているシグナルの情報を返して戻るか、 \fIset\fP のうちのどのシグナルも待機していない場合はエラーを返して戻る。
78 .SH 返り値
79 成功した場合、 \fBsigwaitinfo\fP()  と \fBsigtimedwait\fP()  はシグナル番号 (すなわち 0 より大きい数) を返す。
80 失敗した場合、2 つの関数は \-1 を返し、 \fIerrno\fP はエラーを表す値に設定される。
81 .SH エラー
82 .TP 
83 \fBEAGAIN\fP
84 \fIset\fP のうちのどのシグナルも \fBsigtimedwait\fP()  に指定された \fItimeout\fP の期間内に処理待ちにならなかった。
85 .TP 
86 \fBEINTR\fP
87 シグナル待ちがシグナルハンドラによって中断 (interrupt) された (このハンドラは \fIset\fP にあるシグナル以外のものである)。
88 \fBsignal\fP(7)  参照。
89 .TP 
90 \fBEINVAL\fP
91 \fItimeout\fP が不正である。
92 .SH 準拠
93 POSIX.1\-2001.
94 .SH 注意
95 通常の使用法では、呼び出し側プロセスはこれらの関数より先に \fBsigprocmask\fP(2)  の呼び出すことにより \fIset\fP
96 に含まれるシグナルをブロックし (そのためにこれらのシグナルがこの後に続く \fBsigwaitinfo\fP()  や \fBsigtimedwait\fP()
97 の呼び出しの間に処理待ちになった場合には、デフォルトの動作は行われず)、 これらのシグナルに対するハンドラは設定しない。 マルチスレッドプログラムでは、
98 \fBsigwaitinfo\fP()  や \fBsigtimedwait\fP()
99 を呼び出したスレッド以外のスレッドで、そのシグナルがデフォルトの動作に基いて処理されないように、全てのスレッドで該当シグナルをブロックすべきである。
100
101 指定されたスレッドに対する処理待ちのシグナルの集合は、 そのスレッド自体宛ての処理待ちのシグナル集合と、プロセス全体宛ての
102 処理待ちのシグナル集合をあわせたものである (\fBsignal\fP(7)  参照)。
103
104 \fBSIGKILL\fP と \fBSIGSTOP\fP を待とうとした場合、黙って無視される。
105
106 一つのプロセス内の複数のスレッドが \fBsigwaitinfo\fP()  や \fBsigtimedwait\fP()  で同じシグナルを待って停止した場合、
107 プロセス全体宛てのシグナルが処理待ちになると、複数のスレッドのうち一つだけが 実際にそのシグナルを受信することになる。
108 どのスレッドがシグナルを受信するかは決まっていない。
109
110 POSIX では \fBsigtimedwait\fP()  の引き数 \fItimeout\fP の値を NULL にした場合の意味を未定義としている。
111 \fBsigwaitinfo\fP()  を呼び出したのと同じ意味としてもよいことになっており、 実際 Linux ではこのように動作する。
112
113 Linux では、 \fBsigwaitinfo\fP()  は \fBsigtimedwait\fP()  を用いて実装されたライブラリ関数である。
114 .SH 関連項目
115 \fBkill\fP(2), \fBsigaction\fP(2), \fBsignal\fP(2), \fBsignalfd\fP(2), \fBsigpending\fP(2),
116 \fBsigprocmask\fP(2), \fBsigqueue\fP(3), \fBsigsetops\fP(3), \fBsigwait\fP(3),
117 \fBsignal\fP(7), \fBtime\fP(7)
118 .SH この文書について
119 この man ページは Linux \fIman\-pages\fP プロジェクトのリリース 3.50 の一部
120 である。プロジェクトの説明とバグ報告に関する情報は
121 http://www.kernel.org/doc/man\-pages/ に書かれている。