2 .\" Copyright (c) 2005 by Michael Kerrisk <mtk.manpages@gmail.com>
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.
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.
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
21 .\" Formatted or processed versions of this manual, if unaccompanied by
22 .\" the source, must acknowledge the copyright and authors of this work.
24 .\" Japanese Version Copyright (c) 2005 Akihiro MOTOKI all rights reserved.
25 .\" Translated 2005-12-04, Akihiro MOTOKI <amotoki@dd.iij4u.or.jp>
27 .TH SIGVEC 3 2007-07-26 "Linux" "Linux Programmer's Manual"
30 .\"O sigvec, sigblock, sigsetmask, siggetmask, sigmask \- BSD signal API
31 sigvec, sigblock, sigsetmask, siggetmask, sigmask \- BSD ÈÇ¥·¥°¥Ê¥ë API
34 .B #include <signal.h>
36 .BI "int sigvec(int " sig ", struct sigvec *" vec ", struct sigvec *" ovec );
38 .BI "int sigmask(int " signum );
40 .BI "int sigblock(int " mask );
42 .BI "int sigsetmask(int " mask );
44 .B int siggetmask(void);
47 .\"O Feature Test Macro Requirements for glibc (see
48 .\"O .BR feature_test_macros (7)):
49 glibc ¸þ¤±¤Îµ¡Ç½¸¡ºº¥Þ¥¯¥í¤ÎÍ×·ï
50 .RB ( feature_test_macros (7)
54 .\"O All functions shown above:
59 .\"O These functions are provided in glibc as a compatibility interface
60 .\"O for programs that make use of the historical BSD signal API.
61 .\"O This API is obsolete: new applications should use the POSIX signal API
62 .\"O .RB ( sigaction (2),
63 .\"O .BR sigprocmask (2),
65 ¤³¤ì¤é¤Î´Ø¿ô¤Ï¡¢ÀΤʤ¬¤é¤Î BSD ÈÇ¥·¥°¥Ê¥ë API ¤ò»ÈÍѤ·¤Æ¤¤¤ë¥×¥í¥°¥é¥à
66 ¤ËÂФ·¤Æ¸ß´¹À¤Î¤¢¤ë¥¤¥ó¥¿¥Õ¥§¡¼¥¹¤ò glibc ¤ÇÄ󶡤¹¤ë¤â¤Î¤Ç¤¢¤ë¡£
67 ¤³¤Î API ¤Ï²áµî¤Î¤â¤Î¤Ç¤¢¤ê¡¢¿·¤·¤¤¥¢¥×¥ê¥±¡¼¥·¥ç¥ó¤Ç¤Ï
71 ¤Ê¤É) ¤ò»ÈÍѤ¹¤Ù¤¤Ç¤¢¤ë¡£
75 .\"O function sets and/or gets the disposition of the signal
78 .\"O .BR sigaction (2)).
85 ¤ÎÆ°ºî¤ÎÀßÄꡦ¼èÆÀ¤ò¹Ô¤¦¡£
88 .\"O is not NULL, it points to a
90 .\"O structure that defines the new disposition for
95 ¤Î¿·¤·¤¤Æ°ºî¤òÄêµÁ¤·¤¿
97 ¹½Â¤ÂΤؤΥݥ¤¥ó¥¿¤Ç¤¢¤ë¡£
100 .\"O is not NULL, it points to a
102 .\"O structure that is used to return the previous disposition of
105 ¤Ï¡¢NULL °Ê³°¤Î¾ì¹ç¡¢
107 ¤ÎÊѹ¹Á°¤ÎÆ°ºî¤òÊÖ¤¹¤¿¤á¤Ë»ÈÍѤµ¤ì¤ë
109 ¹½Â¤ÂΤؤΥݥ¤¥ó¥¿¤Ç¤¢¤ë¡£
110 .\"O To obtain the current disposition of
112 .\"O without changing it, specify NULL for
114 .\"O and a non-NULL pointer for
117 ¤ÎÆ°ºî¤òÊѹ¹¤»¤º¤Ë¸½ºß¤ÎÆ°ºî¤ò¼èÆÀ¤¹¤ë¤¿¤á¤Ë¤Ï¡¢
121 ¤Ë NULL ¤Ç¤Ê¤¤¥Ý¥¤¥ó¥¿¤ò»ØÄꤹ¤ì¤Ð¤è¤¤¡£
123 .\"O The dispositions for
127 .\"O cannot be changed.
131 ¤ÎÆ°ºî¤ÏÊѹ¹¤Ç¤¤Ê¤¤¡£
135 .\"O structure has the following form:
137 ¹½Â¤ÂΤϰʲ¼¤ÎÄ̤ê¤Ç¤¢¤ë:
142 void (*sv_handler)(); /* Signal disposition */
143 int sv_mask; /* Signals to be blocked in handler */
144 int sv_flags; /* Flags */
151 .\"O field specifies the disposition of the signal, and is either:
152 .\"O the address of a signal handler function; or
154 .\"O meaning the default disposition applies for the signal; or
156 .\"O meaning that the signal is ignored.
158 ¥Õ¥£¡¼¥ë¥É¤Ï¥·¥°¥Ê¥ë¤ÎÆ°ºî¤ò»ØÄꤹ¤ë¤â¤Î¤Ç¡¢
159 ¥·¥°¥Ê¥ë¥Ï¥ó¥É¥é´Ø¿ô¤Î¥¢¥É¥ì¥¹¤«¡¢
163 ¤Î¤¤¤º¤ì¤«¤ò»ØÄê¤Ç¤¤ë¡£
165 ¤Ï¥·¥°¥Ê¥ë¤ËŬÍѤµ¤ì¤ë¥Ç¥Õ¥©¥ë¥È¤ÎÆ°ºî¤ò°ÕÌ£¤·¡¢
167 ¤Ï¥·¥°¥Ê¥ë¤ò̵»ë¤¹¤ë¤³¤È¤ò°ÕÌ£¤¹¤ë¡£
171 .\"O specifies the address of a signal handler, then
173 .\"O specifies a mask of signals that are to be blocked while
174 .\"O the handler is executing.
175 .\"O In addition, the signal for which the handler is invoked is
176 .\"O also blocked by default.
177 .\"O Attempts to block
181 .\"O are silently ignored.
183 ¤Ë¥·¥°¥Ê¥ë¥Ï¥ó¥É¥é¤Î¥¢¥É¥ì¥¹¤ò»ØÄꤷ¤¿¾ì¹ç¡¢
185 ¤Ï¥Ï¥ó¥É¥é¤¬¼Â¹ÔÃæ¤Ë¥Ö¥í¥Ã¥¯¤µ¤ì¤ë¤Ù¤¥·¥°¥Ê¥ë¤Î¥Þ¥¹¥¯¤ò»ØÄꤹ¤ë¡£
186 ¤Þ¤¿¡¢¥Ï¥ó¥É¥é¤òµ¯Æ°¤·¤¿¥·¥°¥Ê¥ë¼«¿È¤Ï¥Ç¥Õ¥©¥ë¥È¤Ç¥Ö¥í¥Ã¥¯¤µ¤ì¤ë¡£
190 ¤ò¥Ö¥í¥Ã¥¯¤·¤è¤¦¤È¤·¤¿¾ì¹ç¤Ë¤Ï¡¢ÌۤäÆ̵»ë¤µ¤ì¤ë¡£
194 .\"O specifies the address of a signal handler, then the
196 .\"O field specifies flags controlling what happens when the handler is called.
197 .\"O This field may contain zero or more of the following flags:
199 ¤Ë¥·¥°¥Ê¥ë¥Ï¥ó¥É¥é¤Î¥¢¥É¥ì¥¹¤ò»ØÄꤷ¤¿¾ì¹ç¡¢
201 ¥Õ¥£¡¼¥ë¥É¤Ï¥Ï¥ó¥É¥é¤¬¸Æ¤Ð¤ì¤¿ºÝ¤ÎµóÆ°¤òÀ©¸æ¤¹¤ë¥Õ¥é¥°¤ò»ØÄꤹ¤ë¡£
202 ¤³¤Î¥Õ¥£¡¼¥ë¥É¤Ë¤Ï¡¢0 ¤«¡¢°Ê²¼¤Î¥Õ¥é¥°¤ò 1¸Ä°Ê¾å»ØÄê¤Ç¤¤ë:
205 .\"O If the signal handler interrupts a blocking system call,
206 .\"O then upon return from the handler the system call will not be restarted:
207 .\"O instead it will fail with the error
209 .\"O If this flag is not specified, then system calls are restarted
211 ¥·¥°¥Ê¥ë¥Ï¥ó¥É¥é¤¬Ää»ßÃæ¤Î¥·¥¹¥Æ¥à¥³¡¼¥ë¤òÃæÃǤ·¤¿¾ì¹ç¡¢
212 ¥Ï¥ó¥É¥é¤«¤éÉüµ¢¤·¤Æ¤â¡¢¥·¥¹¥Æ¥à¥³¡¼¥ë¤ÏºÆ³«¤µ¤ì¤º¡¢
216 ¤³¤Î¥Õ¥é¥°¤ò»ØÄꤷ¤Ê¤«¤Ã¤¿¾ì¹ç¡¢¥·¥¹¥Æ¥à¥³¡¼¥ë¤Ï
217 ¥Ç¥Õ¥©¥ë¥È¤ÇºÆ³«¤µ¤ì¤ë¡£
220 .\"O Reset the disposition of the signal to the default
221 .\"O before calling the signal handler.
222 .\"O If this flag is not specified, then the handler remains established
223 .\"O until explicitly removed by a later call to
225 .\"O or until the process performs an
227 ¥·¥°¥Ê¥ë¥Ï¥ó¥É¥é¤ò¸Æ¤Ó½Ð¤¹Á°¤Ë¥·¥°¥Ê¥ë¤ÎÆ°ºî¤ò
228 ¥Ç¥Õ¥©¥ë¥È¤Ë¥ê¥»¥Ã¥È¤¹¤ë¡£
229 ¤³¤Î¥Õ¥é¥°¤ò»ØÄꤷ¤Ê¤«¤Ã¤¿¾ì¹ç¡¢¤â¤¦°ìÅÙ
231 ¤ò¸Æ¤Ó½Ð¤·¤ÆÌÀ¼¨Åª¤Ëºï½ü¤µ¤ì¤ë¤«¡¢¥×¥í¥»¥¹¤¬
233 ¤ò¼Â¹Ô¤¹¤ë¤Þ¤Ç¡¢¥Ï¥ó¥É¥é¤ÏÀßÄꤵ¤ì¤¿¤Þ¤Þ¤È¤Ê¤ë¡£
236 .\"O Handle the signal on the alternate signal stack
237 .\"O (historically established under BSD using the obsolete
239 .\"O function; the POSIX replacement is
240 .\"O .BR sigaltstack (2)).
241 ÂåÂØ¥·¥°¥Ê¥ë¥¹¥¿¥Ã¥¯¾å¤Ç¥·¥°¥Ê¥ë¥Ï¥ó¥É¥é¤ò¼Â¹Ô¤¹¤ë
242 (Îò»ËŪ¤Ë¡¢BSD ¤Ç¤ÏÂåÂØ¥·¥°¥Ê¥ë¥¹¥¿¥Ã¥¯¤ÏÇѻߤµ¤ì¤¿´Ø¿ô
244 ¤ò»È¤Ã¤ÆÀßÄꤹ¤ë¡£POSIX ¤Ç¤Ï¡¢Âå¤ï¤ê¤Ë
250 .\"O function constructs and returns a "signal mask" for
252 .\"O For example, we can initialize the
256 .\"O using code such as the following:
261 ¤ËÂФ¹¤ë¡Ö¥·¥°¥Ê¥ë¥Þ¥¹¥¯¡×¤ò¹½À®¤·¤ÆÊÖ¤¹¡£
262 Î㤨¤Ð¡¢°Ê²¼¤Î¤è¤¦¤Ê¥³¡¼¥É¤ò»È¤¦¤È¡¢
269 vec.sv_mask = sigmask(SIGQUIT) | sigpause(SIGABRT);
270 /* Block SIGQUIT and SIGABRT during
276 .\"O function adds the signals in
278 .\"O to the process's signal mask
280 .\"O .IR sigprocmask(SIG_BLOCK) ),
281 .\"O and returns the process's previous signal mask.
282 .\"O Attempts to block
286 .\"O are silently ignored.
290 ¤Ë¤¢¤ë¥·¥°¥Ê¥ë¤ò¥×¥í¥»¥¹¤Î¥·¥°¥Ê¥ë¥Þ¥¹¥¯¤ËÄɲä·
292 .I sigprocmask(SIG_BLOCK)
293 ¤ÈƱÍÍ)¡¢Êѹ¹Á°¤Î¥×¥í¥»¥¹¤Î¥·¥°¥Ê¥ë¥Þ¥¹¥¯¤òÊÖ¤¹¡£
297 ¤ò¥Ö¥í¥Ã¥¯¤·¤è¤¦¤È¤·¤¿¾ì¹ç¤Ë¤Ï¡¢ÌۤäÆ̵»ë¤µ¤ì¤ë¡£
300 .\"O .BR sigsetmask ()
301 .\"O function sets the process's signal mask to the value given in
304 .\"O .IR sigprocmask(SIG_SETMASK) ),
305 .\"O and returns the process's previous signal mask.
307 ´Ø¿ô¤Ï¥×¥í¥»¥¹¤Î¥·¥°¥Ê¥ë¥Þ¥¹¥¯¤ò
309 ¤Ç»ØÄꤵ¤ì¤¿ÃͤËÀßÄꤷ (POSIX ¤Î
310 .I sigprocmask(SIG_SETMASK)
311 ¤ÈƱÍÍ)¡¢Êѹ¹Á°¤Î¥×¥í¥»¥¹¤Î¥·¥°¥Ê¥ë¥Þ¥¹¥¯¤òÊÖ¤¹¡£
314 .\"O .BR siggetmask ()
315 .\"O function returns the process's current signal mask.
316 .\"O This call is equivalent to
317 .\"O .IR sigblock(0) .
319 ´Ø¿ô¤Ï¥×¥í¥»¥¹¤Î¸½ºß¤Î¥·¥°¥Ê¥ë¥Þ¥¹¥¯¤òÊÖ¤¹¡£¤³¤Î´Ø¿ô¤Ï
322 .\"O .SH RETURN VALUE
326 .\"O function returns 0 on success; on error, it returns \-1 and sets
328 .\"O to indicate the error.
330 ´Ø¿ô¤ÏÀ®¸ù¤¹¤ë¤È 0 ¤òÊÖ¤¹¡£¥¨¥é¡¼¤Î¾ì¹ç¡¢\-1 ¤òÊÖ¤·¡¢
332 ¤Ë¥¨¥é¡¼¤ò¼¨¤¹Ãͤò¥»¥Ã¥È¤¹¤ë¡£
337 .\"O .BR sigsetmask ()
338 .\"O functions return the previous signal mask.
342 ¤ÏÊѹ¹Á°¤Î¥·¥°¥Ê¥ë¥Þ¥¹¥¯¤òÊÖ¤¹¡£
346 .\"O function returns the signal mask for
351 ¤Î¥·¥°¥Ê¥ë¥Þ¥¹¥¯¤òÊÖ¤¹¡£
354 .\"O See the ERRORS under
355 .\"O .BR sigaction (2)
357 .\"O .BR sigprocmask (2).
361 ¤Î¡Ö¥¨¥é¡¼¡×¤ÎÀá¤ò»²¾È¡£
362 .\"O .SH "CONFORMING TO"
364 .\"O All of these functions were in
366 .\"O .BR siggetmask (),
367 .\"O whose origin is unclear.
368 .\"O These functions are obsolete: do not use them in new programs.
371 °Ê³°¤ÎÁ´¤Æ¤Ï 4.3BSD ¤Ë¤¢¤Ã¤¿¡£
373 ¤Î½Ð¼«¤Ï¤Ï¤Ã¤¤ê¤·¤Ê¤¤¡£
374 ¤³¤ì¤é¤Î´Ø¿ô¤ÏÇÑ»ßͽÄê¤Ç¤¢¤ê¡¢¿·¤·¤¤¥×¥í¥°¥é¥à¤Ç¤Ï»ÈÍѤ·¤Ê¤¤¤³¤È¡£
379 .\"O function provided reliable semantics (as when calling
384 4.3BSD ¤Ç¤Ï¡¢¿®ÍêÀ¤Î¤¢¤ë¥·¥°¥Ê¥ë½èÍýµ¡¹½¤òÄ󶡤¹¤ë
388 ¤ò¸Æ¤Ó½Ð¤·¤¿¤È¤¤ÈƱÍÍ)¡£
391 .\"O provides unreliable semantics.
392 System V ¤¬Ä󶡤¹¤ë½èÍýµ¡¹½¤Ï¿®ÍêÀ¤Î¤Ê¤¤¤â¤Î¤Ç¤¢¤ë¡£
393 .\"O POSIX.1-2001 leaves these aspects of
398 .\"O for further details.
401 ¤Î¤³¤ÎÅÀ¤Ïµ¬Äꤷ¤Ê¤¤¤Þ¤Þ¤È¤Ê¤Ã¤Æ¤¤¤ë¡£
402 ¤µ¤é¤Ê¤ë¾ÜºÙ¤Ë¤Ä¤¤¤Æ¤Ï
406 .\"O In order to wait for a signal,
407 .\"O BSD and System V both provided a function named
408 .\"O .BR sigpause (3),
409 .\"O but this function has a different argument on the two systems.
411 .\"O .BR sigpause (3)
413 BSD ¤È System V ¤Î¤É¤Á¤é¤Î¥·¥¹¥Æ¥à¤Ç¤â
414 ¥·¥°¥Ê¥ë¤òÂԤĤ¿¤á¤Ë¡¢
416 ¤È¤¤¤¦Ì¾Á°¤Î´Ø¿ô¤¬Ä󶡤µ¤ì¤Æ¤¤¤ë¤¬¡¢
417 ¤³¤Î´Ø¿ô¤Î°ú¤¿ô¤ÏξÊý¤Î¥·¥¹¥Æ¥à¤Ç°Û¤Ê¤ë¡£