OSDN Git Service

0b0d0ec4a35b8eb90e83046cd1a5f532a014bc03
[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()  suspends execution of the calling thread until one of the
50 signals in \fIset\fP is pending (If one of the signals in \fIset\fP is already
51 pending for the calling thread, \fBsigwaitinfo\fP()  will return immediately.)
52
53 \fBsigwaitinfo\fP()  removes the signal from the set of pending signals and
54 returns the signal number as its function result.  If the \fIinfo\fP argument
55 is not NULL, then the buffer that it points to is used to return a structure
56 of type \fIsiginfo_t\fP (see \fBsigaction\fP(2))  containing information about the
57 signal.
58 .PP
59 If multiple signals in \fIset\fP are pending for the caller, the signal that is
60 retrieved by \fBsigwaitinfo\fP()  is determined according to the usual ordering
61 rules; see \fBsignal\fP(7)  for further details.
62 .PP
63 \fBsigtimedwait\fP() は、 \fBsigwaitinfo\fP() と次の点を除いて全く同じように
64 動作する。この関数にはもう 1 つの引き数 \fItimeout\fP があり、シグナル待ち
65 でスレッドが一時停止する最小時間を指定することができる(この時間はシステ
66 ムクロックの粒度に切り上げられ、カーネルのスケジューリング遅延により
67 少しだけ長くなる可能性がある)。この引き数の型は以下のとおりである:
68 .sp
69 .in +4n
70 .nf
71 struct timespec {
72     long    tv_sec;         /* 秒 */
73     long    tv_nsec;        /* ナノ秒 */
74 }
75 .fi
76 .in
77 .sp
78 この構造体の 2 つのフィールドがともに 0 の場合、ポーリングが行われる: \fBsigtimedwait\fP()  は、呼び出し側プロセスに対して
79 待機しているシグナルの情報を返して戻るか、 \fIset\fP のうちのどのシグナルも待機していない場合はエラーを返して戻る。
80 .SH 返り値
81 成功した場合、 \fBsigwaitinfo\fP()  と \fBsigtimedwait\fP()  はシグナル番号 (すなわち 0 より大きい数) を返す。
82 失敗した場合、2 つの関数は \-1 を返し、 \fIerrno\fP はエラーを表す値に設定される。
83 .SH エラー
84 .TP 
85 \fBEAGAIN\fP
86 No signal in \fIset\fP was became pending within the \fItimeout\fP period
87 specified to \fBsigtimedwait\fP().
88 .TP 
89 \fBEINTR\fP
90 シグナル待ちがシグナルハンドラによって中断 (interrupt) された (このハンドラは \fIset\fP にあるシグナル以外のものである)。
91 \fBsignal\fP(7)  参照。
92 .TP 
93 \fBEINVAL\fP
94 \fItimeout\fP が不正である。
95 .SH 準拠
96 POSIX.1\-2001.
97 .SH 注意
98 In normal usage, the calling program blocks the signals in \fIset\fP via a
99 prior call to \fBsigprocmask\fP(2)  (so that the default disposition for these
100 signals does not occur if they become pending between successive calls to
101 \fBsigwaitinfo\fP()  or \fBsigtimedwait\fP())  and does not establish handlers for
102 these signals.  In a multithreaded program, the signal should be blocked in
103 all threads, in order to prevent the signal being treated according to its
104 default disposition in a thread other than the one calling \fBsigwaitinfo\fP()
105 or \fBsigtimedwait\fP()).
106
107 指定されたスレッドに対する処理待ちのシグナルの集合は、 そのスレッド自体宛ての処理待ちのシグナル集合と、プロセス全体宛ての
108 処理待ちのシグナル集合をあわせたものである (\fBsignal\fP(7)  参照)。
109
110 \fBSIGKILL\fP と \fBSIGSTOP\fP を待とうとした場合、黙って無視される。
111
112 If multiple threads of a process are blocked waiting for the same signal(s)
113 in \fBsigwaitinfo\fP()  or \fBsigtimedwait\fP(), then exactly one of the threads
114 will actually receive the signal if it becomes pending for the process as a
115 whole; which of the threads receives the signal is indeterminate.
116
117 POSIX では \fBsigtimedwait\fP()  の引き数 \fItimeout\fP の値を NULL にした場合の意味を未定義としている。
118 \fBsigwaitinfo\fP()  を呼び出したのと同じ意味としてもよいことになっており、 実際 Linux ではこのように動作する。
119
120 Linux では、 \fBsigwaitinfo\fP()  は \fBsigtimedwait\fP()  を用いて実装されたライブラリ関数である。
121 .SH 関連項目
122 \fBkill\fP(2), \fBsigaction\fP(2), \fBsignal\fP(2), \fBsignalfd\fP(2), \fBsigpending\fP(2),
123 \fBsigprocmask\fP(2), \fBsigqueue\fP(3), \fBsigsetops\fP(3), \fBsigwait\fP(3),
124 \fBsignal\fP(7), \fBtime\fP(7)
125 .SH この文書について
126 この man ページは Linux \fIman\-pages\fP プロジェクトのリリース 3.50 の一部
127 である。プロジェクトの説明とバグ報告に関する情報は
128 http://www.kernel.org/doc/man\-pages/ に書かれている。