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)):
50 glibc ¸þ¤±¤Îµ¡Ç½¸¡ºº¥Þ¥¯¥í¤ÎÍ×·ï
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
67 ¤Î¤¦¤Á¤Î¤É¤ì¤«¤Î¥·¥°¥Ê¥ë¤¬ÇÛÁ÷¤µ¤ì¤ë¤Þ¤Ç¡¢
68 ¸Æ¤Ó½Ð¤·¥¹¥ì¥Ã¥É¤Î¼Â¹Ô¤ò°ì»þÄä»ß¤¹¤ë
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.)
74 (¸Æ¤Ó½Ð¤·¥¹¥ì¥Ã¥É¤ËÂФ·¤Æ
76 ¤Î¤¦¤Á¤Î¤É¤ì¤«¤Î¥·¥°¥Ê¥ë¤¬´û¤ËÂÔµ¡Ãæ (pending) ¤Ç¤¢¤ë¾ì¹ç¡¢
78 ¤Ï¤½¤Î¥·¥°¥Ê¥ë¤Î¾ðÊó¤òÊÖ¤·¤Æ¤¹¤°¤ËÌá¤ë)¡£
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 ¤ÏÇÛÁ÷¤µ¤ì¤¿¥·¥°¥Ê¥ë¤òÂÔµ¡Ãæ¤Î¥·¥°¥Ê¥ë¤Î½¸¹ç¤«¤éºï½ü¤·¡¢
85 ´Ø¿ô¤Î·ë²Ì¤È¤·¤Æ¥·¥°¥Ê¥ëÈÖ¹æ¤òÊÖ¤¹¡£
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 ¤Ç¤Ê¤¤¾ì¹ç¡¢ÇÛÁ÷¤µ¤ì¤¿¥·¥°¥Ê¥ë¤Î¾ðÊó¤¬Æþ¤Ã¤¿
99 ¤ò»²¾È) ¤Î¹½Â¤ÂΤòÊÖ¤¹¡£
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.
122 ¤È¼¡¤ÎÅÀ¤ò½ü¤¤¤ÆÁ´¤¯Æ±¤¸¤è¤¦¤ËÆ°ºî¤¹¤ë¡£
123 ¤³¤Î´Ø¿ô¤Ë¤Ï¤â¤¦ 1 ¤Ä¤Î°ú¤¿ô
125 ¤¬¤¢¤ê¡¢¥¹¥ì¥Ã¥É¤¬°ì»þÄä»ß¤¹¤ë»þ´Ö¤Î¾å¸Â¤òÄê¤á¤ë¤³¤È¤¬¤Ç¤¤ë¡£
126 .\"O This argument is of the following type:
127 ¤³¤Î°ú¤¿ô¤Î·¿¤Ï°Ê²¼¤Î¤È¤ª¤ê¤Ç¤¢¤ë:
132 .\"O long tv_sec; /* seconds */
133 long tv_sec; /* ÉÃ */
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
149 ¤Ï¡¢¸Æ¤Ó½Ð¤·Â¦¥×¥í¥»¥¹¤ËÂФ·¤Æ
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 ¤òÊÖ¤·¡¢
170 ¤Ï¥¨¥é¡¼¤òɽ¤¹ÃͤËÀßÄꤵ¤ì¤ë¡£
177 .\"O was delivered within the
179 .\"O period specified to
180 .\"O .BR sigtimedwait ().
182 ¤Î¤¦¤Á¤Î¤É¤Î¥·¥°¥Ê¥ë¤â
186 ¤Î´ü´ÖÆâ¤ËÇÛÁ÷¤µ¤ì¤Ê¤«¤Ã¤¿¡£
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) ¤µ¤ì¤¿
196 ¤Ë¤¢¤ë¥·¥°¥Ê¥ë°Ê³°¤Î¤â¤Î¤Ç¤¢¤ë)¡£
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 Ä̾ï¤Î»ÈÍÑË¡¤Ç¤Ï¡¢¸Æ¤Ó½Ð¤·Â¦¥×¥í¥»¥¹¤Ï¤³¤ì¤é¤Î´Ø¿ô¤è¤êÀè¤Ë
224 ¤Ë´Þ¤Þ¤ì¤ë¥·¥°¥Ê¥ë¤ò¥Ö¥í¥Ã¥¯¤·
225 (¤½¤Î¤¿¤á¤Ë¤³¤ì¤é¤Î¥·¥°¥Ê¥ë¤¬¤³¤Î¸å¤Ë³¤¯
229 ¤Î¸Æ¤Ó½Ð¤·¤Î´Ö¤ËÇÛÁ÷¤µ¤ì¤¿¾ì¹ç¤Ë¤Ï¡¢
230 ¥Ç¥Õ¥©¥ë¥È¤ÎÇÛÃ֤ϹԤï¤ì¤º)¡¢
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 ()).
238 ¥Þ¥ë¥Á¥¹¥ì¥Ã¥É¥×¥í¥°¥é¥à¤Ç¤Ï¡¢
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.
263 ¤òÂԤȤ¦¤È¤·¤¿¾ì¹ç¡¢ÌۤäÆ̵»ë¤µ¤ì¤ë¡£
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.
273 °ì¤Ä¤Î¥×¥í¥»¥¹Æâ¤ÎÊ£¿ô¤Î¥¹¥ì¥Ã¥É¤¬
277 ¤ÇƱ¤¸¥·¥°¥Ê¥ë¤òÂԤäÆÄä»ß¤·¤¿¾ì¹ç¡¢
278 ¥×¥í¥»¥¹Á´Âΰ¸¤Æ¤Î¥·¥°¥Ê¥ë¤¬ÇÛÁ÷¤µ¤ì¤ë¤È¡¢Ê£¿ô¤Î¥¹¥ì¥Ã¥É¤Î¤¦¤Á°ì¤Ä¤À¤±¤¬
279 ¼ÂºÝ¤Ë¤½¤Î¥·¥°¥Ê¥ë¤ò¼õ¿®¤¹¤ë¤³¤È¤Ë¤Ê¤ë¡£
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 ().
307 ¤òÍѤ¤¤Æ¼ÂÁõ¤µ¤ì¤¿¥é¥¤¥Ö¥é¥ê´Ø¿ô¤Ç¤¢¤ë¡£