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 .\" added note on self-signaling, aeb, 2002-06-07
24 .\" added note on CAP_KILL, mtk, 2004-06-16
26 .\" Japanese Version Copyright (c) 2002, 2005 Yuichi SATO
27 .\" all rights reserved.
28 .\" Translated 2002-08-06, Yuichi SATO <ysato@h4.dion.ne.jp>
29 .\" Updated & Modified 2005-01-08, Yuichi SATO <ysato444@yahoo.co.jp>
30 .\" Updated 2007-09-08, Akihiro MOTOKI <amotoki@dd.iij4u.or.jp>, LDP v2.64
32 .TH SIGQUEUE 2 2007-07-26 "Linux" "Linux Programmer's Manual"
35 .\"O sigqueue, rt_sigqueueinfo \- queue a signal and data to a process
36 sigqueue, rt_sigqueueinfo \- ¥·¥°¥Ê¥ë¤È¥Ç¡¼¥¿¤ò¥×¥í¥»¥¹¤ËÁ÷¤ë
39 .B #include <signal.h>
41 .BI "int sigqueue(pid_t " pid ", int " sig ", const union sigval " value );
44 .\"O Feature Test Macro Requirements for glibc (see
45 .\"O .BR feature_test_macros (7)):
46 glibc ¸þ¤±¤Îµ¡Ç½¸¡ºº¥Þ¥¯¥í¤ÎÍ×·ï
47 .RB ( feature_test_macros (7)
52 _POSIX_C_SOURCE\ >=\ 199309L
56 .\"O sends the signal specified in
58 .\"O to the process whose PID is given in
63 ¤Ç»ØÄꤵ¤ì¤¿¥·¥°¥Ê¥ë¤ò¡¢PID ¤¬
65 ¤Ç¤¢¤ë¥×¥í¥»¥¹¤ËÁ÷¤ë¡£
66 .\"O The permissions required to send a signal are the same as for
68 ¥·¥°¥Ê¥ë¤òÁ÷¤ë¤Î¤ËɬÍפʸ¢¸Â¤Ï
73 .\"O the null signal (0) can be used to check if a process with a given
76 ¤ÈƱÍͤˡ¢¥Ì¥ë¡¦¥·¥°¥Ê¥ë (0) ¤ò»È¤Ã¤Æ
77 »ØÄꤷ¤¿ PID ¤Î¥×¥í¥»¥¹¤¬Â¸ºß¤¹¤ë¤«¤ò¥Á¥§¥Ã¥¯¤¹¤ë¤³¤È¤¬¤Ç¤¤ë¡£
81 .\"O argument is used to specify an accompanying item of data (either an integer
82 .\"O or a pointer value) to be sent with the signal, and has the following type:
84 °ú¤¿ô¤Ï¥·¥°¥Ê¥ë¤È°ì½ï¤ËÁ÷¤ë¥Ç¡¼¥¿¤ÎÉÕ°¥¢¥¤¥Æ¥à¤ò»ØÄꤹ¤ë¡£
86 ¤Ï (À°¿ô¤Þ¤¿¤Ï¥Ý¥¤¥ó¥¿¤ÎÃͤǤ¢¤ê) °Ê²¼¤Î¤è¤¦¤Ê·¿¤Ç¤¢¤ë¡£
97 .\"O If the receiving process has installed a handler for this signal using the
100 .\"O .BR sigaction (2),
101 .\"O then it can obtain this data via the
105 .\"O structure passed as the second argument to the handler.
106 ¼õ¼èÀè¤Î¥×¥í¥»¥¹¤Ë¡¢¤³¤Î¥·¥°¥Ê¥ë¤ËÂФ¹¤ë¥Ï¥ó¥É¥é¤ò
110 ¤ò»ØÄꤷ¤Æ) ¥¤¥ó¥¹¥È¡¼¥ë¤·¤Æ¤ª¤¯¤È¡¢
111 ¤½¤Î¥Ï¥ó¥É¥é¤ÎÂè 2 °ú¤¿ô¤ËÅϤµ¤ì¤ë
115 ¥Õ¥£¡¼¥ë¥É¤Ë¤è¤Ã¤Æ¡¢¤³¤Î¥Ç¡¼¥¿¤ò¼èÆÀ¤Ç¤¤ë¡£
116 .\"O Furthermore, the
118 .\"O field of that structure will be set to
125 .\"O .SH "RETURN VALUE"
129 .\"O returns 0, indicating that the signal was successfully
130 .\"O queued to the receiving process.
134 ¤³¤ì¤Ï¼õ¤±¼è¤ê¦¥×¥í¥»¥¹¤ÎÂÔ¤Á¹ÔÎó¤Ë
135 ¥·¥°¥Ê¥ë¤¬Àµ¤·¤¯Æþ¤ì¤é¤ì¤¿¤³¤È¤ò¼¨¤¹¡£
136 .\"O Otherwise \-1 is returned and
138 .\"O is set to indicate the error.
139 ¼ºÇÔ¤·¤¿¾ì¹ç¤Ï \-1 ¤¬ÊÖ¤µ¤ì¡¢
141 ¤¬¥¨¥é¡¼¤òɽ¤¹ÃͤËÀßÄꤵ¤ì¤ë¡£
146 .\"O The limit of signals which may be queued has been reached.
147 ÂÔ¤Á¹ÔÎó¤ËÆþ¤ì¤é¤ì¤ë¥·¥°¥Ê¥ë¤ÎºÇÂç¿ô¤Ë㤷¤¿
150 .\"O for further information.)
162 .\"O The process does not have permission to send the signal
163 .\"O to the receiving process.
164 ¤³¤Î¥×¥í¥»¥¹¤Ë¤Ï¡¢¼õ¤±¼è¤ê¦¥×¥í¥»¥¹¤Ë¥·¥°¥Ê¥ë¤òÁ÷¤ë¸¢¸Â¤¬¤Ê¤¤¡£
165 .\"O For the required permissions, see
167 ɬÍפʸ¢¸Â¤Ë¤Ä¤¤¤Æ¤Ï¡¢
172 .\"O No process has a PID matching
175 ¤Ë¥Þ¥Ã¥Á¤¹¤ë PID ¤Î¥×¥í¥»¥¹¤¬¤Ê¤¤¡£
178 .\"O This system call first appeared in Linux 2.2.
179 ¤³¤Î¥·¥¹¥Æ¥à¥³¡¼¥ë¤Ï Linux 2.2 ¤Ç½é¤á¤ÆÅо줷¤¿¡£
180 .\"O .SH "CONFORMING TO"
185 .\"O If this function results in the sending of a signal to the process
186 .\"O that invoked it, and that signal was not blocked by the calling thread,
187 .\"O and no other threads were willing to handle this signal (either by
188 .\"O having it unblocked, or by waiting for it using
189 .\"O .BR sigwait (3)),
190 .\"O then at least some signal must be delivered to this thread before this
191 .\"O function returns.
193 .\"Osato: ¤³¤Îʸ¾Ï¤ÏŤ¹¤®¤ë¤Î¤È it ¤¬Â¿¤¹¤®¤ë¤¿¤á¤ËÎɤ¯Ê¬¤«¤ê¤Þ¤»¤ó¡£
194 .\"Osato: that invoked it ( = this function)
195 .\"Osato: by having it ( = that signal) unblocked
196 .\"Osato: by waiting for it ( = that signal) using sigwait(3)
197 .\"Osato: ¤È¤·¤ÆÌõ¤·¤Æ¤ß¤Þ¤·¤¿¡£
198 .\"Osato: ¾Ü¤·¤¤Êý¤«¤é¤Î¸æ»ØŦ¤ò¤ªÂÔ¤Á¤·¤Þ¤¹¡£
200 ¤³¤Î´Ø¿ô¤ò¸Æ¤Ó½Ð¤·¤¿¥×¥í¥»¥¹¤Ë¤³¤Î´Ø¿ô¤¬¥·¥°¥Ê¥ë¤òÁ÷¤Ã¤¿¤È¤¤Ë¡¢
201 ¥·¥°¥Ê¥ë¤¬¸Æ¤Ó½Ð¤·Â¦¥¹¥ì¥Ã¥É¤Ë¥Ö¥í¥Ã¥¯¤µ¤ì¤º¡¢
202 ¤«¤Ä (¥·¥°¥Ê¥ë¤¬¥Ö¥í¥Ã¥¯¤µ¤ì¤Ê¤«¤Ã¤¿¡¢¤Þ¤¿¤Ï
204 ¤ò»ÈÍѤ¹¤ë¤Î¤òÂԤäƤ¤¤ë¤³¤È¤Ë¤è¤ê)
205 ¤³¤Î¥·¥°¥Ê¥ë¤ò°·¤¦¥¹¥ì¥Ã¥É¤¬²¿¤â¤Ê¤¤¾ì¹ç¤Ï¡¢
206 ¤³¤Î´Ø¿ô¤¬¥ê¥¿¡¼¥ó¤¹¤ëÁ°¤Ë¡¢¾¯¤Ê¤¯¤È¤â
207 ¤½¤Î¥¹¥ì¥Ã¥É¤ËÂФ·¤Æ¥·¥°¥Ê¥ë¤¬ÇÛÁ÷¤µ¤ì¤Æ¤¤¤Ê¤±¤ì¤Ð¤Ê¤é¤Ê¤¤¡£
209 .\"O On Linux, the underlying system call is actually named
210 .\"O .BR rt_sigqueueinfo (),
211 .\"O and differs in its third argument, which is the
213 .\"O structure that will be supplied to the receiving process's
214 .\"O signal handler or returned by the receiving process's
215 .\"O .BR sigtimedwait (2)
217 .\"O Inside the glibc
219 .\"O wrapper, this argument,
221 .\"O is initialized as follows:
222 Linux ¤Ç¤Ï¡¢¸Æ¤Ó½Ð¤µ¤ì¤ë¥·¥¹¥Æ¥à¥³¡¼¥ë¤Î̾Á°¤Ï¼ÂºÝ¤Ë¤Ï
223 .BR rt_sigqueueinfo ()
225 .BR rt_sigqueueinfo ()
226 ¤Ç¤Ï 3 ÈÖÌܤΰú¤¿ô¤Ë°ã¤¤¤¬¤¢¤ê¡¢
230 ¹½Â¤ÂΤϡ¢¥·¥°¥Ê¥ë¤ò¼õ¿®¤¹¤ë¥×¥í¥»¥¹¤Î¥·¥°¥Ê¥ë¥Ï¥ó¥É¥é¤ËÅϤµ¤ì¤¿¤ê¡¢
231 ¥·¥°¥Ê¥ë¼õ¿®¥×¥í¥»¥¹¤Î
233 ¥·¥¹¥Æ¥à¥³¡¼¥ë¤«¤éÊÖ¤µ¤ì¤¿¤ê¤¹¤ë¡£
236 ¥é¥Ã¥Ñ¡¼´Ø¿ôÆâÉô¤Ç¤Ï¡¢
239 ¤Ï°Ê²¼¤Î¤è¤¦¤Ë½é´ü²½¤µ¤ì¤ë¡£
243 info.si_signo = sig; /* argument supplied to sigqueue() */
244 info.si_code = SI_QUEUE;
245 info.si_pid = getpid(); /* Process ID of sender */
246 info.si_uid = getuid(); /* Real UID of sender */
247 info.si_value = val; /* argument supplied to sigqueue() */