OSDN Git Service

886688cef459fee3d4a130692221b7f7880d12a4
[linuxjm/LDP_man-pages.git] / release / man3 / sigvec.3
1 .\" t
2 .\" Copyright (c) 2005 by Michael Kerrisk <mtk.manpages@gmail.com>
3 .\"
4 .\" %%%LICENSE_START(VERBATIM)
5 .\" Permission is granted to make and distribute verbatim copies of this
6 .\" manual provided the copyright notice and this permission notice are
7 .\" preserved on all copies.
8 .\"
9 .\" Permission is granted to copy and distribute modified versions of this
10 .\" manual under the conditions for verbatim copying, provided that the
11 .\" entire resulting derived work is distributed under the terms of a
12 .\" permission notice identical to this one.
13 .\"
14 .\" Since the Linux kernel and libraries are constantly changing, this
15 .\" manual page may be incorrect or out-of-date.  The author(s) assume no
16 .\" responsibility for errors or omissions, or for damages resulting from
17 .\" the use of the information contained herein.  The author(s) may not
18 .\" have taken the same level of care in the production of this manual,
19 .\" which is licensed free of charge, as they might when working
20 .\" professionally.
21 .\"
22 .\" Formatted or processed versions of this manual, if unaccompanied by
23 .\" the source, must acknowledge the copyright and authors of this work.
24 .\" %%%LICENSE_END
25 .\"
26 .\"*******************************************************************
27 .\"
28 .\" This file was generated with po4a. Translate the source file.
29 .\"
30 .\"*******************************************************************
31 .TH SIGVEC 3 2012\-09\-06 Linux "Linux Programmer's Manual"
32 .SH 名前
33 sigvec, sigblock, sigsetmask, siggetmask, sigmask \- BSD 版シグナル API
34 .SH 書式
35 \fB#include <signal.h>\fP
36 .sp
37 \fBint sigvec(int \fP\fIsig\fP\fB, struct sigvec *\fP\fIvec\fP\fB, struct sigvec
38 *\fP\fIovec\fP\fB);\fP
39 .sp
40 \fBint sigmask(int \fP\fIsignum\fP\fB);\fP
41 .sp
42 \fBint sigblock(int \fP\fImask\fP\fB);\fP
43 .sp
44 \fBint sigsetmask(int \fP\fImask\fP\fB);\fP
45 .sp
46 \fBint siggetmask(void);\fP
47 .sp
48 .in -4n
49 glibc 向けの機能検査マクロの要件 (\fBfeature_test_macros\fP(7)  参照):
50 .in
51 .sp
52 上記の全ての関数: _BSD_SOURCE
53 .SH 説明
54 These functions are provided in glibc as a compatibility interface for
55 programs that make use of the historical BSD signal API.  This API is
56 obsolete: new applications should use the POSIX signal API (\fBsigaction\fP(2),
57 \fBsigprocmask\fP(2), etc.).
58
59 関数 \fBsigvec\fP()  は、(POSIX の \fBsigaction\fP(2)  と同様に) シグナル \fIsig\fP の動作の設定・取得を行う。
60 \fIvec\fP は、NULL 以外の場合、 \fIsig\fP の新しい動作を定義した \fIsigvec\fP 構造体へのポインタである。 \fIovec\fP
61 は、NULL 以外の場合、 \fIsig\fP の変更前の動作を返すために使用される \fIsigvec\fP 構造体へのポインタである。 \fIsig\fP
62 の動作を変更せずに現在の動作を取得するためには、 \fIvec\fP に NULL を指定し、 \fIovec\fP に NULL でないポインタを指定すればよい。
63
64 シグナル \fBSIGKILL\fP と \fBSIGSTOP\fP に対する動作は変更できない。
65
66 \fIsigvec\fP 構造体は以下の通りである:
67 .in +4n
68 .nf
69
70 struct sigvec {
71     void (*sv_handler)(int); /* Signal disposition */
72     int    sv_mask;          /* Signals to be blocked in handler */
73     int    sv_flags;         /* Flags */
74 };
75
76 .fi
77 .in
78 The \fIsv_handler\fP field specifies the disposition of the signal, and is
79 either: the address of a signal handler function; \fBSIG_DFL\fP, meaning the
80 default disposition applies for the signal; or \fBSIG_IGN\fP, meaning that the
81 signal is ignored.
82
83 If \fIsv_handler\fP specifies the address of a signal handler, then \fIsv_mask\fP
84 specifies a mask of signals that are to be blocked while the handler is
85 executing.  In addition, the signal for which the handler is invoked is also
86 blocked.  Attempts to block \fBSIGKILL\fP or \fBSIGSTOP\fP are silently ignored.
87
88 \fIsv_handler\fP にシグナルハンドラのアドレスを指定した場合、 \fIsv_flags\fP
89 フィールドはハンドラが呼ばれた際の挙動を制御するフラグを指定する。 このフィールドには、0 か、以下のフラグを 1個以上指定できる:
90 .TP 
91 \fBSV_INTERRUPT\fP
92 シグナルハンドラが停止中のシステムコールを中断した場合、 ハンドラから復帰しても、システムコールは再開されず、 エラー \fBEINTR\fP で失敗する。
93 このフラグを指定しなかった場合、システムコールは デフォルトで再開される。
94 .TP 
95 \fBSV_RESETHAND\fP
96 シグナルハンドラを呼び出す前にシグナルの動作を デフォルトにリセットする。 このフラグを指定しなかった場合、もう一度 \fBsigvec\fP()
97 を呼び出して明示的に削除されるか、プロセスが \fBexecve\fP(2)  を実行するまで、ハンドラは設定されたままとなる。
98 .TP 
99 \fBSV_ONSTACK\fP
100 代替シグナルスタック上でシグナルハンドラを実行する (歴史的に、BSD では代替シグナルスタックは廃止された関数 \fBsigstack\fP()
101 を使って設定する。POSIX では、代わりに \fBsigaltstack\fP(2)  を使用する)。
102 .PP
103 関数 \fBsigmask\fP()  は \fIsignum\fP に対する「シグナルマスク」を構成して返す。 例えば、以下のようなコードを使うと、
104 \fBsigvec\fP()  に渡す \fIvec.sv_mask\fP を初期化できる。
105 .nf
106
107     vec.sv_mask = sigmask(SIGQUIT) | sigpause(SIGABRT);
108                 /* Block SIGQUIT and SIGABRT during
109                    handler execution */
110 .fi
111 .PP
112 \fBsigblock\fP()  関数は、 \fImask\fP にあるシグナルをプロセスのシグナルマスクに追加し (POSIX の
113 \fIsigprocmask(SIG_BLOCK)\fP と同様)、変更前のプロセスのシグナルマスクを返す。 \fBSIGKILL\fP や \fBSIGSTOP\fP
114 をブロックしようとした場合には、黙って無視される。
115 .PP
116 \fBsigsetmask\fP()  関数はプロセスのシグナルマスクを \fImask\fP で指定された値に設定し (POSIX の
117 \fIsigprocmask(SIG_SETMASK)\fP と同様)、変更前のプロセスのシグナルマスクを返す。
118 .PP
119 \fBsiggetmask\fP()  関数はプロセスの現在のシグナルマスクを返す。この関数は \fIsigblock(0)\fP と等価である。
120 .SH 返り値
121 \fBsigvec\fP()  関数は成功すると 0 を返す。エラーの場合、\-1 を返し、 \fIerrno\fP にエラーを示す値をセットする。
122
123 \fBsigblock\fP()  と \fBsigsetmask\fP()  は変更前のシグナルマスクを返す。
124
125 \fBsigmask\fP()  関数は \fIsignum\fP のシグナルマスクを返す。
126 .SH エラー
127 \fBsigaction\fP(2)  と \fBsigprocmask\fP(2)  の「エラー」の節を参照。
128 .SH 準拠
129 これらの関数のうち \fBsiggetmask\fP()  以外の全ては 4.3BSD にあった。 \fBsiggetmask\fP()  の出自ははっきりしない。
130 これらの関数は廃止予定であり、新しいプログラムでは使用しないこと。
131 .SH 注意
132 4.3BSD では、信頼性のあるシグナル処理機構を提供する (\fIvec.sv_mask\fP を 0 で \fBsigvec\fP()
133 を呼び出したときと同様)。 System V が提供する処理機構は信頼性のないものである。 POSIX.1\-2001 では、 \fBsignal\fP()
134 のこの点は規定しないままとなっている。 さらなる詳細については \fBsignal\fP(2)  を参照。
135
136 BSD と System V のどちらのシステムでも シグナルを待つために、 \fBsigpause\fP(3)  という名前の関数が提供されているが、
137 この関数の引き数は両方のシステムで異なる。 詳細は \fBsigpause\fP(3)  を参照。
138 .SH 関連項目
139 \fBkill\fP(2), \fBpause\fP(2), \fBsigaction\fP(2), \fBsignal\fP(2), \fBsigprocmask\fP(2),
140 \fBraise\fP(3), \fBsigpause\fP(3), \fBsigset\fP(3), \fBsignal\fP(7)
141 .SH この文書について
142 この man ページは Linux \fIman\-pages\fP プロジェクトのリリース 3.50 の一部
143 である。プロジェクトの説明とバグ報告に関する情報は
144 http://www.kernel.org/doc/man\-pages/ に書かれている。