1 .\" Copyright (c) 2002 Michael Kerrisk <mtk.manpages@gmail.com>
3 .\" Permission is granted to make and distribute verbatim copies of this
4 .\" manual provided the copyright notice and this permission notice are
5 .\" preserved on all copies.
7 .\" Permission is granted to copy and distribute modified versions of this
8 .\" manual under the conditions for verbatim copying, provided that the
9 .\" entire resulting derived work is distributed under the terms of a
10 .\" permission notice identical to this one.
12 .\" Since the Linux kernel and libraries are constantly changing, this
13 .\" manual page may be incorrect or out-of-date. The author(s) assume no
14 .\" responsibility for errors or omissions, or for damages resulting from
15 .\" the use of the information contained herein. The author(s) may not
16 .\" have taken the same level of care in the production of this manual,
17 .\" which is licensed free of charge, as they might when working
20 .\" Formatted or processed versions of this manual, if unaccompanied by
21 .\" the source, must acknowledge the copyright and authors of this work.
23 .\" Japanese Version Copyright (c) 2003 Yuichi SATO
24 .\" all rights reserved.
25 .\" Translated 2003-02-16, Yuichi SATO <ysato444@yahoo.co.jp>
26 .\" Updated 2006-07-21, Akihiro MOTOKI <amotoki@dd.iij4u.or.jp>, LDP v2.36
27 .\" Updated 2008-08-07, Akihiro MOTOKI, LDP v3.05
29 .\"WORD: pending 待機中である
31 .TH SIGWAITINFO 2 2011-10-03 "Linux" "Linux Programmer's Manual"
34 .\"O sigwaitinfo, sigtimedwait \- synchronously wait for queued signals
35 sigwaitinfo, sigtimedwait \- キューに入れられたシグナルを同期して待つ
39 .B #include <signal.h>
41 .BI "int sigwaitinfo(const sigset_t *" set ", siginfo_t *" info ");"
43 .BI "int sigtimedwait(const sigset_t *" set ", siginfo_t *" info ", "
44 .BI " const struct timespec *" timeout ");"
48 .\"O Feature Test Macro Requirements for glibc (see
49 .\"O .BR feature_test_macros (7)):
51 .RB ( feature_test_macros (7)
57 _POSIX_C_SOURCE\ >=\ 199309L
60 .\"O .BR sigwaitinfo ()
61 .\"O suspends execution of the calling thread until one of the signals in
69 .\"O (If one of the signals in
71 .\"O is already pending for the calling thread,
72 .\"O .BR sigwaitinfo ()
73 .\"O will return immediately with information about that signal.)
76 のうちのどれかのシグナルが既に待機中 (pending) である場合、
80 .\"O .BR sigwaitinfo ()
81 .\"O removes the delivered signal from the set of pending
82 .\"O signals and returns the signal number as its function result.
84 は配送されたシグナルを待機中のシグナルの集合から削除し、
88 .\"O argument is not NULL,
89 .\"O then it returns a structure of type
92 .\"O .BR sigaction (2))
93 .\"O containing information about the signal.
95 引き数が NULL でない場合、配送されたシグナルの情報が入った
101 .\"O Signals returned via
102 .\"O .BR sigwaitinfo ()
103 .\"O are delivered in the usual order; see
105 .\"O for further details.
107 で返されるシグナルは、通常の順番で配送される。
112 .\"O .BR sigtimedwait ()
113 .\"O operates in exactly the same way as
114 .\"O .BR sigwaitinfo ()
115 .\"O except that it has an additional argument,
117 .\"O which enables an upper bound to be placed on the time for which
118 .\"O the thread is suspended.
125 があり、スレッドが一時停止する時間の上限を定めることができる。
126 .\"O This argument is of the following type:
132 .\"O long tv_sec; /* seconds */
134 .\"O long tv_nsec; /* nanoseconds */
135 long tv_nsec; /* ナノ秒 */
140 .\"O If both fields of this structure are specified as 0, a poll is performed:
141 この構造体の 2 つのフィールドがともに 0 の場合、ポーリングが行われる:
142 .\"O .BR sigtimedwait ()
143 .\"O returns immediately, either with information about a signal that
144 .\"O was pending for the caller, or with an error
145 .\"O if none of the signals in
150 待機しているシグナルの情報を返して戻るか、
152 のうちのどのシグナルも待機していない場合はエラーを返して戻る。
153 .\"O .SH "RETURN VALUE"
155 .\"O On success, both
156 .\"O .BR sigwaitinfo ()
158 .\"O .BR sigtimedwait ()
159 .\"O return a signal number (i.e., a value greater than zero).
164 はシグナル番号 (すなわち 0 より大きい数) を返す。
165 .\"O On failure both calls return \-1, with
167 .\"O set to indicate the error.
168 失敗した場合、2 つの関数は \-1 を返し、
177 .\"O was delivered within the
179 .\"O period specified to
180 .\"O .BR sigtimedwait ().
189 .\"O The wait was interrupted by a signal handler; see
191 .\"O (This handler was for a signal other than one of those in
193 シグナル待ちがシグナルハンドラによって中断 (interrupt) された
205 .\"O .SH "CONFORMING TO"
210 .\"O In normal usage, the calling program blocks the signals in
212 .\"O via a prior call to
213 .\"O .BR sigprocmask (2)
214 .\"O (so that the default disposition for these signals does not occur if they
215 .\"O are delivered between successive calls to
216 .\"O .BR sigwaitinfo ()
218 .\"O .BR sigtimedwait())
219 .\"O and does not establish handlers for these signals.
220 通常の使用法では、呼び出し側プロセスはこれらの関数より先に
225 (そのためにこれらのシグナルがこの後に続く
231 これらのシグナルに対するハンドラは設定しない。
232 .\"O In a multithreaded program,
233 .\"O the signal should be blocked in all threads to prevent
234 .\"O the signal being delivered to a thread other than the one calling
235 .\"O .BR sigwaitinfo ()
237 .\"O .BR sigtimedwait ()).
242 を呼び出したスレッド以外のスレッドにそのシグナルが配送されないように、
243 全てのスレッドで該当シグナルをブロックすべきである。
245 .\"O The set of signals that is pending for a given thread is the
246 .\"O union of the set of signals that is pending specifically for that thread
247 .\"O and the set of signals that is pending for the process as a whole (see
248 .\"O .BR signal (7)).
249 指定されたスレッドに対する処理待ちのシグナルの集合は、
250 そのスレッド自体宛ての処理待ちのシグナル集合と、プロセス全体宛ての
251 処理待ちのシグナル集合をあわせたものである
255 .\"O Attempts to wait for
259 .\"O are silently ignored.
265 .\"O If multiple threads of a process are blocked
266 .\"O waiting for the same signal(s) in
267 .\"O .BR sigwaitinfo ()
269 .\"O .BR sigtimedwait (),
270 .\"O then exactly one of the threads will actually receive the
271 .\"O signal if it is delivered to the process as a whole;
272 .\"O which of the threads receives the signal is indeterminate.
278 プロセス全体宛てのシグナルが配送されると、複数のスレッドのうち一つだけが
280 どのスレッドがシグナルを受信するかは決まっていない。
282 .\"O POSIX leaves the meaning of a NULL value for the
285 .\"O .BR sigtimedwait ()
286 .\"O unspecified, permitting the possibility that this has the same meaning
288 .\"O .BR sigwaitinfo (),
289 .\"O and indeed this is what is done on Linux.
294 の値を NULL にした場合の意味を未定義としている。
296 を呼び出したのと同じ意味としてもよいことになっており、
297 実際 Linux ではこのように動作する。
300 .\"O .BR sigwaitinfo ()
301 .\"O is a library function implemented on top of
302 .\"O .BR sigtimedwait ().