'\" t .\" Copyright (c) 2005 by Michael Kerrisk .\" .\" Permission is granted to make and distribute verbatim copies of this .\" manual provided the copyright notice and this permission notice are .\" preserved on all copies. .\" .\" Permission is granted to copy and distribute modified versions of this .\" manual under the conditions for verbatim copying, provided that the .\" entire resulting derived work is distributed under the terms of a .\" permission notice identical to this one. .\" .\" Since the Linux kernel and libraries are constantly changing, this .\" manual page may be incorrect or out-of-date. The author(s) assume no .\" responsibility for errors or omissions, or for damages resulting from .\" the use of the information contained herein. The author(s) may not .\" have taken the same level of care in the production of this manual, .\" which is licensed free of charge, as they might when working .\" professionally. .\" .\" Formatted or processed versions of this manual, if unaccompanied by .\" the source, must acknowledge the copyright and authors of this work. .\" .\" Japanese Version Copyright (c) 2005 Akihiro MOTOKI all rights reserved. .\" Translated 2005-12-04, Akihiro MOTOKI .\" .TH SIGVEC 3 2007-07-26 "Linux" "Linux Programmer's Manual" .\"O .SH NAME .SH 名前 .\"O sigvec, sigblock, sigsetmask, siggetmask, sigmask \- BSD signal API sigvec, sigblock, sigsetmask, siggetmask, sigmask \- BSD 版シグナル API .\"O .SH SYNOPSIS .SH 書式 .B #include .sp .BI "int sigvec(int " sig ", struct sigvec *" vec ", struct sigvec *" ovec ); .sp .BI "int sigmask(int " signum ); .sp .BI "int sigblock(int " mask ); .sp .BI "int sigsetmask(int " mask ); .sp .B int siggetmask(void); .sp .in -4n .\"O Feature Test Macro Requirements for glibc (see .\"O .BR feature_test_macros (7)): glibc 向けの機能検査マクロの要件 .RB ( feature_test_macros (7) 参照): .in .sp .\"O All functions shown above: 上記の全ての関数: _BSD_SOURCE .\"O .SH DESCRIPTION .SH 説明 .\"O These functions are provided in glibc as a compatibility interface .\"O for programs that make use of the historical BSD signal API. .\"O This API is obsolete: new applications should use the POSIX signal API .\"O .RB ( sigaction (2), .\"O .BR sigprocmask (2), .\"O etc.) これらの関数は、昔ながらの BSD 版シグナル API を使用しているプログラム に対して互換性のあるインタフェースを glibc で提供するものである。 この API は過去のものであり、新しいアプリケーションでは POSIX シグナル API .RB ( sigaction (2), .BR sigprocmask (2) など) を使用すべきである。 .\"O The .\"O .BR sigvec () .\"O function sets and/or gets the disposition of the signal .\"O .I sig .\"O (like the POSIX .\"O .BR sigaction (2)). 関数 .BR sigvec () は、(POSIX の .BR sigaction (2) と同様に) シグナル .I sig の動作の設定・取得を行う。 .\"O If .\"O .I vec .\"O is not NULL, it points to a .\"O .I sigvec .\"O structure that defines the new disposition for .\"O .IR sig . .I vec は、NULL 以外の場合、 .I sig の新しい動作を定義した .I sigvec 構造体へのポインタである。 .\"O If .\"O .I ovec .\"O is not NULL, it points to a .\"O .I sigvec .\"O structure that is used to return the previous disposition of .\"O .IR sig . .I ovec は、NULL 以外の場合、 .I sig の変更前の動作を返すために使用される .I sigvec 構造体へのポインタである。 .\"O To obtain the current disposition of .\"O .I sig .\"O without changing it, specify NULL for .\"O .IR vec , .\"O and a non-NULL pointer for .\"O .IR ovec . .I sig の動作を変更せずに現在の動作を取得するためには、 .I vec に NULL を指定し、 .I ovec に NULL でないポインタを指定すればよい。 .\"O The dispositions for .\"O .B SIGKILL .\"O and .\"O .B SIGSTOP .\"O cannot be changed. .B SIGKILL と .B SIGSTOP の動作は変更できない。 .\"O The .\"O .I sigvec .\"O structure has the following form: .I sigvec 構造体は以下の通りである: .in +4n .nf struct sigvec { void (*sv_handler)(); /* Signal disposition */ int sv_mask; /* Signals to be blocked in handler */ int sv_flags; /* Flags */ }; .fi .in .\"O The .\"O .I sv_handler .\"O field specifies the disposition of the signal, and is either: .\"O the address of a signal handler function; or .\"O .B SIG_DFL .\"O meaning the default disposition applies for the signal; or .\"O .B SIG_IGN .\"O meaning that the signal is ignored. .I sv_handler フィールドはシグナルの動作を指定するもので、 シグナルハンドラ関数のアドレスか、 .B SIG_DFL と .B SIG_IGN のいずれかを指定できる。 .B SIG_DFL はシグナルに適用されるデフォルトの動作を意味し、 .B SIG_IGN はシグナルを無視することを意味する。 .\"O If .\"O .I sv_handler .\"O specifies the address of a signal handler, then .\"O .I sv_mask .\"O specifies a mask of signals that are to be blocked while .\"O the handler is executing. .\"O In addition, the signal for which the handler is invoked is .\"O also blocked by default. .\"O Attempts to block .\"O .B SIGKILL .\"O or .\"O .B SIGSTOP .\"O are silently ignored. .I sv_handler にシグナルハンドラのアドレスを指定した場合、 .I sv_mask はハンドラが実行中にブロックされるべきシグナルのマスクを指定する。 また、ハンドラを起動したシグナル自身はデフォルトでブロックされる。 .B SIGKILL か .B SIGSTOP をブロックしようとした場合には、黙って無視される。 .\"O If .\"O .I sv_handler .\"O specifies the address of a signal handler, then the .\"O .I sv_flags .\"O field specifies flags controlling what happens when the handler is called. .\"O This field may contain zero or more of the following flags: .I sv_handler にシグナルハンドラのアドレスを指定した場合、 .I sv_flags フィールドはハンドラが呼ばれた際の挙動を制御するフラグを指定する。 このフィールドには、0 か、以下のフラグを 1個以上指定できる: .TP .B SV_INTERRUPT .\"O If the signal handler interrupts a blocking system call, .\"O then upon return from the handler the system call will not be restarted: .\"O instead it will fail with the error .\"O .BR EINTR . .\"O If this flag is not specified, then system calls are restarted .\"O by default. シグナルハンドラが停止中のシステムコールを中断した場合、 ハンドラから復帰しても、システムコールは再開されず、 エラー .B EINTR で失敗する。 このフラグを指定しなかった場合、システムコールは デフォルトで再開される。 .TP .B SV_RESETHAND .\"O Reset the disposition of the signal to the default .\"O before calling the signal handler. .\"O If this flag is not specified, then the handler remains established .\"O until explicitly removed by a later call to .\"O .BR sigvec () .\"O or until the process performs an .\"O .BR execve (2). シグナルハンドラを呼び出す前にシグナルの動作を デフォルトにリセットする。 このフラグを指定しなかった場合、もう一度 .BR sigvec () を呼び出して明示的に削除されるか、プロセスが .BR execve (2) を実行するまで、ハンドラは設定されたままとなる。 .TP .B SV_ONSTACK .\"O Handle the signal on the alternate signal stack .\"O (historically established under BSD using the obsolete .\"O .BR sigstack () .\"O function; the POSIX replacement is .\"O .BR sigaltstack (2)). 代替シグナルスタック上でシグナルハンドラを実行する (歴史的に、BSD では代替シグナルスタックは廃止された関数 .BR sigstack () を使って設定する。POSIX では、代わりに .BR sigaltstack (2) を使用する)。 .PP .\"O The .\"O .BR sigmask () .\"O function constructs and returns a "signal mask" for .\"O .IR signum . .\"O For example, we can initialize the .\"O .I vec.sv_mask .\"O field given to .\"O .BR sigvec () .\"O using code such as the following: 関数 .BR sigmask () は .I signum に対する「シグナルマスク」を構成して返す。 例えば、以下のようなコードを使うと、 .BR sigvec () に渡す .I vec.sv_mask を初期化できる。 .nf vec.sv_mask = sigmask(SIGQUIT) | sigpause(SIGABRT); /* Block SIGQUIT and SIGABRT during handler execution */ .fi .PP .\"O The .\"O .BR sigblock () .\"O function adds the signals in .\"O .I mask .\"O to the process's signal mask .\"O (like POSIX .\"O .IR sigprocmask(SIG_BLOCK) ), .\"O and returns the process's previous signal mask. .\"O Attempts to block .\"O .B SIGKILL .\"O or .\"O .B SIGSTOP .\"O are silently ignored. .BR sigblock () 関数は、 .I mask にあるシグナルをプロセスのシグナルマスクに追加し (POSIX の .I sigprocmask(SIG_BLOCK) と同様)、変更前のプロセスのシグナルマスクを返す。 .B SIGKILL や .B SIGSTOP をブロックしようとした場合には、黙って無視される。 .PP .\"O The .\"O .BR sigsetmask () .\"O function sets the process's signal mask to the value given in .\"O .I mask .\"O (like POSIX .\"O .IR sigprocmask(SIG_SETMASK) ), .\"O and returns the process's previous signal mask. .BR sigsetmask () 関数はプロセスのシグナルマスクを .I mask で指定された値に設定し (POSIX の .I sigprocmask(SIG_SETMASK) と同様)、変更前のプロセスのシグナルマスクを返す。 .PP .\"O The .\"O .BR siggetmask () .\"O function returns the process's current signal mask. .\"O This call is equivalent to .\"O .IR sigblock(0) . .BR siggetmask () 関数はプロセスの現在のシグナルマスクを返す。この関数は .I sigblock(0) と等価である。 .\"O .SH RETURN VALUE .SH 返り値 .\"O The .\"O .BR sigvec () .\"O function returns 0 on success; on error, it returns \-1 and sets .\"O .I errno .\"O to indicate the error. .BR sigvec () 関数は成功すると 0 を返す。エラーの場合、\-1 を返し、 .I errno にエラーを示す値をセットする。 .\"O The .\"O .BR sigblock () .\"O and .\"O .BR sigsetmask () .\"O functions return the previous signal mask. .BR sigblock () と .BR sigsetmask () は変更前のシグナルマスクを返す。 .\"O The .\"O .BR sigmask () .\"O function returns the signal mask for .\"O .IR signum . .BR sigmask () 関数は .I signum のシグナルマスクを返す。 .\"O .SH ERRORS .SH エラー .\"O See the ERRORS under .\"O .BR sigaction (2) .\"O and .\"O .BR sigprocmask (2). .BR sigaction (2) と .BR sigprocmask (2) の「エラー」の節を参照。 .\"O .SH "CONFORMING TO" .SH 準拠 .\"O All of these functions were in .\"O 4.3BSD, except .\"O .BR siggetmask (), .\"O whose origin is unclear. .\"O These functions are obsolete: do not use them in new programs. これらの関数のうち .BR siggetmask () 以外の全ては 4.3BSD にあった。 .BR siggetmask () の出自ははっきりしない。 これらの関数は廃止予定であり、新しいプログラムでは使用しないこと。 .\"O .SH NOTES .SH 注意 .\"O On 4.3BSD, the .\"O .BR signal () .\"O function provided reliable semantics (as when calling .\"O .BR sigvec () .\"O with .\"O .I vec.sv_mask .\"O equal to 0). 4.3BSD では、信頼性のあるシグナル処理機構を提供する .RI ( vec.sv_mask を 0 で .BR sigvec () を呼び出したときと同様)。 .\"O On System V, .\"O .BR signal () .\"O provides unreliable semantics. System V が提供する処理機構は信頼性のないものである。 .\"O POSIX.1-2001 leaves these aspects of .\"O .BR signal () .\"O unspecified. .\"O See .\"O .BR signal (2) .\"O for further details. POSIX.1-2001 では、 .BR signal () のこの点は規定しないままとなっている。 さらなる詳細については .BR signal (2) を参照。 .\"O In order to wait for a signal, .\"O BSD and System V both provided a function named .\"O .BR sigpause (3), .\"O but this function has a different argument on the two systems. .\"O See .\"O .BR sigpause (3) .\"O for details. BSD と System V のどちらのシステムでも シグナルを待つために、 .BR sigpause (3) という名前の関数が提供されているが、 この関数の引き数は両方のシステムで異なる。 詳細は .BR sigpause (3) を参照。 .\"O .SH "SEE ALSO" .SH 関連項目 .BR kill (2), .BR pause (2), .BR sigaction (2), .BR signal (2), .BR sigprocmask (2), .BR raise (3), .BR sigpause (3), .BR sigset (3), .BR signal (7)