OSDN Git Service

75b53e4c434438ab3abe64cebcba478d7a8c98b7
[linuxjm/LDP_man-pages.git] / draft / man3 / sigvec.3
1 '\" t
2 .\" Copyright (c) 2005 by Michael Kerrisk <mtk.manpages@gmail.com>
3 .\"
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.
7 .\"
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.
12 .\"
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
19 .\" professionally.
20 .\"
21 .\" Formatted or processed versions of this manual, if unaccompanied by
22 .\" the source, must acknowledge the copyright and authors of this work.
23 .\"
24 .\" Japanese Version Copyright (c) 2005 Akihiro MOTOKI all rights reserved.
25 .\" Translated 2005-12-04, Akihiro MOTOKI <amotoki@dd.iij4u.or.jp>
26 .\"
27 .TH SIGVEC 3 2007-07-26 "Linux" "Linux Programmer's Manual"
28 .\"O .SH NAME
29 .SH 名前
30 .\"O sigvec, sigblock, sigsetmask, siggetmask, sigmask \- BSD signal API
31 sigvec, sigblock, sigsetmask, siggetmask, sigmask \- BSD 版シグナル API
32 .\"O .SH SYNOPSIS
33 .SH 書式
34 .B #include <signal.h>
35 .sp
36 .BI "int sigvec(int " sig ", struct sigvec *" vec ", struct sigvec *" ovec );
37 .sp
38 .BI "int sigmask(int " signum );
39 .sp
40 .BI "int sigblock(int " mask );
41 .sp
42 .BI "int sigsetmask(int " mask );
43 .sp
44 .B int siggetmask(void);
45 .sp
46 .in -4n
47 .\"O Feature Test Macro Requirements for glibc (see
48 .\"O .BR feature_test_macros (7)):
49 glibc 向けの機能検査マクロの要件
50 .RB ( feature_test_macros (7)
51 参照):
52 .in
53 .sp
54 .\"O All functions shown above:
55 上記の全ての関数:
56 _BSD_SOURCE
57 .\"O .SH DESCRIPTION
58 .SH 説明
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),
64 .\"O etc.)
65 これらの関数は、昔ながらの BSD 版シグナル API を使用しているプログラム
66 に対して互換性のあるインタフェースを glibc で提供するものである。
67 この API は過去のものであり、新しいアプリケーションでは
68 POSIX シグナル API
69 .RB ( sigaction (2),
70 .BR sigprocmask (2)
71 など) を使用すべきである。
72
73 .\"O The
74 .\"O .BR sigvec ()
75 .\"O function sets and/or gets the disposition of the signal
76 .\"O .I sig
77 .\"O (like the POSIX
78 .\"O .BR sigaction (2)).
79 関数
80 .BR sigvec ()
81 は、(POSIX の
82 .BR sigaction (2)
83 と同様に) シグナル
84 .I sig
85 の動作の設定・取得を行う。
86 .\"O If
87 .\"O .I vec
88 .\"O is not NULL, it points to a
89 .\"O .I sigvec
90 .\"O structure that defines the new disposition for
91 .\"O .IR sig .
92 .I vec
93 は、NULL 以外の場合、
94 .I sig
95 の新しい動作を定義した
96 .I sigvec
97 構造体へのポインタである。
98 .\"O If
99 .\"O .I ovec
100 .\"O is not NULL, it points to a
101 .\"O .I sigvec
102 .\"O structure that is used to return the previous disposition of
103 .\"O .IR sig .
104 .I ovec
105 は、NULL 以外の場合、
106 .I sig
107 の変更前の動作を返すために使用される
108 .I sigvec
109 構造体へのポインタである。
110 .\"O To obtain the current disposition of
111 .\"O .I sig
112 .\"O without changing it, specify NULL for
113 .\"O .IR vec ,
114 .\"O and a non-NULL pointer for
115 .\"O .IR ovec .
116 .I sig
117 の動作を変更せずに現在の動作を取得するためには、
118 .I vec
119 に NULL を指定し、
120 .I ovec
121 に NULL でないポインタを指定すればよい。
122
123 .\"O The dispositions for
124 .\"O .B SIGKILL
125 .\"O and
126 .\"O .B SIGSTOP
127 .\"O cannot be changed.
128 .B SIGKILL
129
130 .B SIGSTOP
131 の動作は変更できない。
132
133 .\"O The
134 .\"O .I sigvec
135 .\"O structure has the following form:
136 .I sigvec
137 構造体は以下の通りである:
138 .in +4n
139 .nf
140
141 struct sigvec {
142     void (*sv_handler)();  /* Signal disposition */
143     int    sv_mask;        /* Signals to be blocked in handler */
144     int    sv_flags;       /* Flags */
145 };
146
147 .fi
148 .in
149 .\"O The
150 .\"O .I sv_handler
151 .\"O field specifies the disposition of the signal, and is either:
152 .\"O the address of a signal handler function; or
153 .\"O .B SIG_DFL
154 .\"O meaning the default disposition applies for the signal; or
155 .\"O .B SIG_IGN
156 .\"O meaning that the signal is ignored.
157 .I sv_handler
158 フィールドはシグナルの動作を指定するもので、
159 シグナルハンドラ関数のアドレスか、
160 .B SIG_DFL
161
162 .B SIG_IGN
163 のいずれかを指定できる。
164 .B SIG_DFL
165 はシグナルに適用されるデフォルトの動作を意味し、
166 .B SIG_IGN
167 はシグナルを無視することを意味する。
168
169 .\"O If
170 .\"O .I sv_handler
171 .\"O specifies the address of a signal handler, then
172 .\"O .I sv_mask
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
178 .\"O .B SIGKILL
179 .\"O or
180 .\"O .B SIGSTOP
181 .\"O are silently ignored.
182 .I sv_handler
183 にシグナルハンドラのアドレスを指定した場合、
184 .I sv_mask
185 はハンドラが実行中にブロックされるべきシグナルのマスクを指定する。
186 また、ハンドラを起動したシグナル自身はデフォルトでブロックされる。
187 .B SIGKILL
188
189 .B SIGSTOP
190 をブロックしようとした場合には、黙って無視される。
191
192 .\"O If
193 .\"O .I sv_handler
194 .\"O specifies the address of a signal handler, then the
195 .\"O .I sv_flags
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:
198 .I sv_handler
199 にシグナルハンドラのアドレスを指定した場合、
200 .I sv_flags
201 フィールドはハンドラが呼ばれた際の挙動を制御するフラグを指定する。
202 このフィールドには、0 か、以下のフラグを 1個以上指定できる:
203 .TP
204 .B SV_INTERRUPT
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
208 .\"O .BR EINTR .
209 .\"O If this flag is not specified, then system calls are restarted
210 .\"O by default.
211 シグナルハンドラが停止中のシステムコールを中断した場合、
212 ハンドラから復帰しても、システムコールは再開されず、
213 エラー
214 .B EINTR
215 で失敗する。
216 このフラグを指定しなかった場合、システムコールは
217 デフォルトで再開される。
218 .TP
219 .B SV_RESETHAND
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
224 .\"O .BR sigvec ()
225 .\"O or until the process performs an
226 .\"O .BR execve (2).
227 シグナルハンドラを呼び出す前にシグナルの動作を
228 デフォルトにリセットする。
229 このフラグを指定しなかった場合、もう一度
230 .BR sigvec ()
231 を呼び出して明示的に削除されるか、プロセスが
232 .BR execve (2)
233 を実行するまで、ハンドラは設定されたままとなる。
234 .TP
235 .B SV_ONSTACK
236 .\"O Handle the signal on the alternate signal stack
237 .\"O (historically established under BSD using the obsolete
238 .\"O .BR sigstack ()
239 .\"O function; the POSIX replacement is
240 .\"O .BR sigaltstack (2)).
241 代替シグナルスタック上でシグナルハンドラを実行する
242 (歴史的に、BSD では代替シグナルスタックは廃止された関数
243 .BR sigstack ()
244 を使って設定する。POSIX では、代わりに
245 .BR sigaltstack (2)
246 を使用する)。
247 .PP
248 .\"O The
249 .\"O .BR sigmask ()
250 .\"O function constructs and returns a "signal mask" for
251 .\"O .IR signum .
252 .\"O For example, we can initialize the
253 .\"O .I vec.sv_mask
254 .\"O field given to
255 .\"O .BR sigvec ()
256 .\"O using code such as the following:
257 関数
258 .BR sigmask ()
259
260 .I signum
261 に対する「シグナルマスク」を構成して返す。
262 例えば、以下のようなコードを使うと、
263 .BR sigvec ()
264 に渡す
265 .I vec.sv_mask
266 を初期化できる。
267 .nf
268
269     vec.sv_mask = sigmask(SIGQUIT) | sigpause(SIGABRT);
270                 /* Block SIGQUIT and SIGABRT during
271                    handler execution */
272 .fi
273 .PP
274 .\"O The
275 .\"O .BR sigblock ()
276 .\"O function adds the signals in
277 .\"O .I mask
278 .\"O to the process's signal mask
279 .\"O (like POSIX
280 .\"O .IR sigprocmask(SIG_BLOCK) ),
281 .\"O and returns the process's previous signal mask.
282 .\"O Attempts to block
283 .\"O .B SIGKILL
284 .\"O or
285 .\"O .B SIGSTOP
286 .\"O are silently ignored.
287 .BR sigblock ()
288 関数は、
289 .I mask
290 にあるシグナルをプロセスのシグナルマスクに追加し
291 (POSIX の
292 .I sigprocmask(SIG_BLOCK)
293 と同様)、変更前のプロセスのシグナルマスクを返す。
294 .B SIGKILL
295
296 .B SIGSTOP
297 をブロックしようとした場合には、黙って無視される。
298 .PP
299 .\"O The
300 .\"O .BR sigsetmask ()
301 .\"O function sets the process's signal mask to the value given in
302 .\"O .I mask
303 .\"O (like POSIX
304 .\"O .IR sigprocmask(SIG_SETMASK) ),
305 .\"O and returns the process's previous signal mask.
306 .BR sigsetmask ()
307 関数はプロセスのシグナルマスクを
308 .I mask
309 で指定された値に設定し (POSIX の
310 .I sigprocmask(SIG_SETMASK)
311 と同様)、変更前のプロセスのシグナルマスクを返す。
312 .PP
313 .\"O The
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) .
318 .BR siggetmask ()
319 関数はプロセスの現在のシグナルマスクを返す。この関数は
320 .I sigblock(0)
321 と等価である。
322 .\"O .SH RETURN VALUE
323 .SH 返り値
324 .\"O The
325 .\"O .BR sigvec ()
326 .\"O function returns 0 on success; on error, it returns \-1 and sets
327 .\"O .I errno
328 .\"O to indicate the error.
329 .BR sigvec ()
330 関数は成功すると 0 を返す。エラーの場合、\-1 を返し、
331 .I errno
332 にエラーを示す値をセットする。
333
334 .\"O The
335 .\"O .BR sigblock ()
336 .\"O and
337 .\"O .BR sigsetmask ()
338 .\"O functions return the previous signal mask.
339 .BR sigblock ()
340
341 .BR sigsetmask ()
342 は変更前のシグナルマスクを返す。
343
344 .\"O The
345 .\"O .BR sigmask ()
346 .\"O function returns the signal mask for
347 .\"O .IR signum .
348 .BR sigmask ()
349 関数は
350 .I signum
351 のシグナルマスクを返す。
352 .\"O .SH ERRORS
353 .SH エラー
354 .\"O See the ERRORS under
355 .\"O .BR sigaction (2)
356 .\"O and
357 .\"O .BR sigprocmask (2).
358 .BR sigaction (2)
359
360 .BR sigprocmask (2)
361 の「エラー」の節を参照。
362 .\"O .SH "CONFORMING TO"
363 .SH 準拠
364 .\"O All of these functions were in
365 .\"O 4.3BSD, except
366 .\"O .BR siggetmask (),
367 .\"O whose origin is unclear.
368 .\"O These functions are obsolete: do not use them in new programs.
369 これらの関数のうち
370 .BR siggetmask ()
371 以外の全ては 4.3BSD にあった。
372 .BR siggetmask ()
373 の出自ははっきりしない。
374 これらの関数は廃止予定であり、新しいプログラムでは使用しないこと。
375 .\"O .SH NOTES
376 .SH 注意
377 .\"O On 4.3BSD, the
378 .\"O .BR signal ()
379 .\"O function provided reliable semantics (as when calling
380 .\"O .BR sigvec ()
381 .\"O with
382 .\"O .I vec.sv_mask
383 .\"O equal to 0).
384 4.3BSD では、信頼性のあるシグナル処理機構を提供する
385 .RI ( vec.sv_mask
386 を 0 で
387 .BR sigvec ()
388 を呼び出したときと同様)。
389 .\"O On System V,
390 .\"O .BR signal ()
391 .\"O provides unreliable semantics.
392 System V が提供する処理機構は信頼性のないものである。
393 .\"O POSIX.1-2001 leaves these aspects of
394 .\"O .BR signal ()
395 .\"O unspecified.
396 .\"O See
397 .\"O .BR signal (2)
398 .\"O for further details.
399 POSIX.1-2001 では、
400 .BR signal ()
401 のこの点は規定しないままとなっている。
402 さらなる詳細については
403 .BR signal (2)
404 を参照。
405
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.
410 .\"O See
411 .\"O .BR sigpause (3)
412 .\"O for details.
413 BSD と System V のどちらのシステムでも
414 シグナルを待つために、
415 .BR sigpause (3)
416 という名前の関数が提供されているが、
417 この関数の引き数は両方のシステムで異なる。
418 詳細は
419 .BR sigpause (3)
420 を参照。
421 .\"O .SH "SEE ALSO"
422 .SH 関連項目
423 .BR kill (2),
424 .BR pause (2),
425 .BR sigaction (2),
426 .BR signal (2),
427 .BR sigprocmask (2),
428 .BR raise (3),
429 .BR sigpause (3),
430 .BR sigset (3),
431 .BR signal (7)