OSDN Git Service

(split) LDP_man-pages: update original to v3.35.
[linuxjm/LDP_man-pages.git] / draft / man2 / sigqueue.2
1 .\" Copyright (c) 2002 Michael Kerrisk <mtk.manpages@gmail.com>
2 .\"
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.
6 .\"
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.
11 .\"
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
18 .\" professionally.
19 .\"
20 .\" Formatted or processed versions of this manual, if unaccompanied by
21 .\" the source, must acknowledge the copyright and authors of this work.
22 .\"
23 .\" added note on self-signaling, aeb, 2002-06-07
24 .\" added note on CAP_KILL, mtk, 2004-06-16
25 .\"
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
31 .\"
32 .TH SIGQUEUE 2 2007-07-26 "Linux" "Linux Programmer's Manual"
33 .\"O .SH NAME
34 .SH Ì¾Á°
35 .\"O sigqueue, rt_sigqueueinfo \- queue a signal and data to a process
36 sigqueue, rt_sigqueueinfo \- ¥·¥°¥Ê¥ë¤È¥Ç¡¼¥¿¤ò¥×¥í¥»¥¹¤ËÁ÷¤ë
37 .\"O .SH SYNOPSIS
38 .SH ½ñ¼°
39 .B #include <signal.h>
40 .sp
41 .BI "int sigqueue(pid_t " pid ", int " sig ", const union sigval " value );
42 .sp
43 .in -4n
44 .\"O Feature Test Macro Requirements for glibc (see
45 .\"O .BR feature_test_macros (7)):
46 glibc ¸þ¤±¤Îµ¡Ç½¸¡ºº¥Þ¥¯¥í¤ÎÍ×·ï
47 .RB ( feature_test_macros (7)
48 »²¾È):
49 .in
50 .sp
51 .BR sigqueue ():
52 _POSIX_C_SOURCE\ >=\ 199309L
53 .\"O .SH DESCRIPTION
54 .SH ÀâÌÀ
55 .\"O .BR sigqueue ()
56 .\"O sends the signal specified in
57 .\"O .I sig
58 .\"O to the process whose PID is given in
59 .\"O .IR pid .
60 .BR sigqueue ()
61 ¤Ï
62 .I sig
63 ¤Ç»ØÄꤵ¤ì¤¿¥·¥°¥Ê¥ë¤ò¡¢PID ¤¬
64 .I pid
65 ¤Ç¤¢¤ë¥×¥í¥»¥¹¤ËÁ÷¤ë¡£
66 .\"O The permissions required to send a signal are the same as for
67 .\"O .BR kill (2).
68 ¥·¥°¥Ê¥ë¤òÁ÷¤ë¤Î¤ËɬÍפʸ¢¸Â¤Ï
69 .BR kill (2)
70 ¤ÈƱ¤¸¤Ç¤¢¤ë¡£
71 .\"O As with
72 .\"O .BR kill (2),
73 .\"O the null signal (0) can be used to check if a process with a given
74 .\"O PID exists.
75 .BR kill (2)
76 ¤ÈƱÍͤˡ¢¥Ì¥ë¡¦¥·¥°¥Ê¥ë (0) ¤ò»È¤Ã¤Æ
77 »ØÄꤷ¤¿ PID ¤Î¥×¥í¥»¥¹¤¬Â¸ºß¤¹¤ë¤«¤ò¥Á¥§¥Ã¥¯¤¹¤ë¤³¤È¤¬¤Ç¤­¤ë¡£
78 .PP
79 .\"O The
80 .\"O .I value
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:
83 .I value
84 °ú¤­¿ô¤Ï¥·¥°¥Ê¥ë¤È°ì½ï¤ËÁ÷¤ë¥Ç¡¼¥¿¤ÎÉÕ°¥¢¥¤¥Æ¥à¤ò»ØÄꤹ¤ë¡£
85 .I value
86 ¤Ï (À°¿ô¤Þ¤¿¤Ï¥Ý¥¤¥ó¥¿¤ÎÃͤǤ¢¤ê) °Ê²¼¤Î¤è¤¦¤Ê·¿¤Ç¤¢¤ë¡£
87 .sp
88 .in +4n
89 .nf
90 union sigval {
91     int   sival_int;
92     void *sival_ptr;
93 };
94 .fi
95 .in
96
97 .\"O If the receiving process has installed a handler for this signal using the
98 .\"O .B SA_SIGINFO
99 .\"O flag to
100 .\"O .BR sigaction (2),
101 .\"O then it can obtain this data via the
102 .\"O .I si_value
103 .\"O field of the
104 .\"O .I siginfo_t
105 .\"O structure passed as the second argument to the handler.
106 ¼õ¼èÀè¤Î¥×¥í¥»¥¹¤Ë¡¢¤³¤Î¥·¥°¥Ê¥ë¤ËÂФ¹¤ë¥Ï¥ó¥É¥é¤ò
107 .RB ( sigaction (2)
108 ¤Ë
109 .B SA_SIGINFO
110 ¤ò»ØÄꤷ¤Æ) ¥¤¥ó¥¹¥È¡¼¥ë¤·¤Æ¤ª¤¯¤È¡¢
111 ¤½¤Î¥Ï¥ó¥É¥é¤ÎÂè 2 °ú¤­¿ô¤ËÅϤµ¤ì¤ë
112 .I siginfo_t
113 ¹½Â¤ÂΤÎ
114 .I si_value
115 ¥Õ¥£¡¼¥ë¥É¤Ë¤è¤Ã¤Æ¡¢¤³¤Î¥Ç¡¼¥¿¤ò¼èÆÀ¤Ç¤­¤ë¡£
116 .\"O Furthermore, the
117 .\"O .I si_code
118 .\"O field of that structure will be set to
119 .\"O .BR SI_QUEUE .
120 ¤µ¤é¤Ë¡¢¤³¤Î¹½Â¤ÂΤÎ
121 .I si_code
122 ¥Õ¥£¡¼¥ë¥É¤Ï
123 .B SI_QUEUE
124 ¤ËÀßÄꤵ¤ì¤ë¡£
125 .\"O .SH "RETURN VALUE"
126 .SH ÊÖ¤êÃÍ
127 .\"O On success,
128 .\"O .BR sigqueue ()
129 .\"O returns 0, indicating that the signal was successfully
130 .\"O queued to the receiving process.
131 À®¸ù¤·¤¿¾ì¹ç¡¢
132 .BR sigqueue ()
133 ¤Ï 0 ¤òÊÖ¤¹¡£
134 ¤³¤ì¤Ï¼õ¤±¼è¤ê¦¥×¥í¥»¥¹¤ÎÂÔ¤Á¹ÔÎó¤Ë
135 ¥·¥°¥Ê¥ë¤¬Àµ¤·¤¯Æþ¤ì¤é¤ì¤¿¤³¤È¤ò¼¨¤¹¡£
136 .\"O Otherwise \-1 is returned and
137 .\"O .I errno
138 .\"O is set to indicate the error.
139 ¼ºÇÔ¤·¤¿¾ì¹ç¤Ï \-1 ¤¬ÊÖ¤µ¤ì¡¢
140 .I errno
141 ¤¬¥¨¥é¡¼¤òɽ¤¹ÃͤËÀßÄꤵ¤ì¤ë¡£
142 .\"O .SH ERRORS
143 .SH ¥¨¥é¡¼
144 .TP
145 .B EAGAIN
146 .\"O The limit of signals which may be queued has been reached.
147 ÂÔ¤Á¹ÔÎó¤ËÆþ¤ì¤é¤ì¤ë¥·¥°¥Ê¥ë¤ÎºÇÂç¿ô¤Ë㤷¤¿
148 .\"O (See
149 .\"O .BR signal (7)
150 .\"O for further information.)
151 (¤è¤ê¾Ü¤·¤¤¾ðÊó¤Ï
152 .BR signal (7)
153 ¤ò»²¾È¤¹¤ë¤³¤È)¡£
154 .TP
155 .B EINVAL
156 .\"O .I sig
157 .\"O was invalid.
158 .I sig
159 ¤¬ÉÔÀµ¤Ç¤¢¤ë¡£
160 .TP
161 .B EPERM
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
166 .\"O .BR kill (2).
167 ɬÍפʸ¢¸Â¤Ë¤Ä¤¤¤Æ¤Ï¡¢
168 .BR kill (2)
169 ¤ò»²¾È¤¹¤ë¤³¤È¡£
170 .TP
171 .B ESRCH
172 .\"O No process has a PID matching
173 .\"O .IR pid .
174 .I pid
175 ¤Ë¥Þ¥Ã¥Á¤¹¤ë PID ¤Î¥×¥í¥»¥¹¤¬¤Ê¤¤¡£
176 .\"O .SH VERSIONS
177 .SH ¥Ð¡¼¥¸¥ç¥ó
178 .\"O This system call first appeared in Linux 2.2.
179 ¤³¤Î¥·¥¹¥Æ¥à¥³¡¼¥ë¤Ï Linux 2.2 ¤Ç½é¤á¤ÆÅо줷¤¿¡£
180 .\"O .SH "CONFORMING TO"
181 .SH ½àµò
182 POSIX.1-2001.
183 .\"O .SH NOTES
184 .SH Ãí°Õ
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.
192 .\"Osato:
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: ¾Ü¤·¤¤Êý¤«¤é¤Î¸æ»ØŦ¤ò¤ªÂÔ¤Á¤·¤Þ¤¹¡£
199 .\"Osato:
200 ¤³¤Î´Ø¿ô¤ò¸Æ¤Ó½Ð¤·¤¿¥×¥í¥»¥¹¤Ë¤³¤Î´Ø¿ô¤¬¥·¥°¥Ê¥ë¤òÁ÷¤Ã¤¿¤È¤­¤Ë¡¢
201 ¥·¥°¥Ê¥ë¤¬¸Æ¤Ó½Ð¤·Â¦¥¹¥ì¥Ã¥É¤Ë¥Ö¥í¥Ã¥¯¤µ¤ì¤º¡¢
202 ¤«¤Ä (¥·¥°¥Ê¥ë¤¬¥Ö¥í¥Ã¥¯¤µ¤ì¤Ê¤«¤Ã¤¿¡¢¤Þ¤¿¤Ï
203 .BR sigwait (3)
204 ¤ò»ÈÍѤ¹¤ë¤Î¤òÂԤäƤ¤¤ë¤³¤È¤Ë¤è¤ê)
205 ¤³¤Î¥·¥°¥Ê¥ë¤ò°·¤¦¥¹¥ì¥Ã¥É¤¬²¿¤â¤Ê¤¤¾ì¹ç¤Ï¡¢
206 ¤³¤Î´Ø¿ô¤¬¥ê¥¿¡¼¥ó¤¹¤ëÁ°¤Ë¡¢¾¯¤Ê¤¯¤È¤â
207 ¤½¤Î¥¹¥ì¥Ã¥É¤ËÂФ·¤Æ¥·¥°¥Ê¥ë¤¬ÇÛÁ÷¤µ¤ì¤Æ¤¤¤Ê¤±¤ì¤Ð¤Ê¤é¤Ê¤¤¡£
208
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
212 .\"O .I siginfo_t
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)
216 .\"O call.
217 .\"O Inside the glibc
218 .\"O .BR sigqueue ()
219 .\"O wrapper, this argument,
220 .\"O .IR info ,
221 .\"O is initialized as follows:
222 Linux ¤Ç¤Ï¡¢¸Æ¤Ó½Ð¤µ¤ì¤ë¥·¥¹¥Æ¥à¥³¡¼¥ë¤Î̾Á°¤Ï¼ÂºÝ¤Ë¤Ï
223 .BR rt_sigqueueinfo ()
224 ¤Ç¤¢¤ë¡£
225 .BR rt_sigqueueinfo ()
226 ¤Ç¤Ï 3 ÈÖÌܤΰú¤­¿ô¤Ë°ã¤¤¤¬¤¢¤ê¡¢
227 .I siginfo_t
228 ¹½Â¤ÂΤǤ¢¤ë¡£
229 .I siginfo_t
230 ¹½Â¤ÂΤϡ¢¥·¥°¥Ê¥ë¤ò¼õ¿®¤¹¤ë¥×¥í¥»¥¹¤Î¥·¥°¥Ê¥ë¥Ï¥ó¥É¥é¤ËÅϤµ¤ì¤¿¤ê¡¢
231 ¥·¥°¥Ê¥ë¼õ¿®¥×¥í¥»¥¹¤Î
232 .BR sigtimedwait (2)
233 ¥·¥¹¥Æ¥à¥³¡¼¥ë¤«¤éÊÖ¤µ¤ì¤¿¤ê¤¹¤ë¡£
234 glibc ¤Î
235 .BR sigqueue ()
236 ¥é¥Ã¥Ñ¡¼´Ø¿ôÆâÉô¤Ç¤Ï¡¢
237 ¤³¤Î°ú¤­¿ô
238 .I info
239 ¤Ï°Ê²¼¤Î¤è¤¦¤Ë½é´ü²½¤µ¤ì¤ë¡£
240 .in +4n
241 .nf
242
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() */
248 .fi
249 .in
250 .\"O .SH "SEE ALSO"
251 .SH ´ØÏ¢¹àÌÜ
252 .BR kill (2),
253 .BR sigaction (2),
254 .BR signal (2),
255 .BR sigwait (3),
256 .BR signal (7)