OSDN Git Service

26ceef4f5cfe77bab6488c286dfdc43d29817a60
[linuxjm/LDP_man-pages.git] / release / man2 / sigreturn.2
1 .\" Copyright (C) 2008, 2014, Michael Kerrisk <mtk.manpages@gmail.com>
2 .\"
3 .\" %%%LICENSE_START(VERBATIM)
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 .\" %%%LICENSE_END
24 .\"
25 .\" Created   Sat Aug 21 1995     Thomas K. Dyas <tdyas@eden.rutgers.edu>
26 .\" Modified Tue Oct 22 22:09:03 1996 by Eric S. Raymond <esr@thyrsus.com>
27 .\" 2008-06-26, mtk, added some more detail on the work done by sigreturn()
28 .\" 2014-12-05, mtk, rewrote all of the rest of the original page
29 .\"
30 .\"*******************************************************************
31 .\"
32 .\" This file was generated with po4a. Translate the source file.
33 .\"
34 .\"*******************************************************************
35 .\"
36 .\" Japanese Version Copyright (c) 1997 HANATAKA Shinya
37 .\"         all rights reserved.
38 .\" Translated 1997-03-03, HANATAKA Shinya <hanataka@abyss.rim.or.jp>
39 .\" Updated 2005-09-04, Akihiro MOTOKI <amotoki@dd.iij4u.or.jp>
40 .\" Updated 2008-08-07, Akihiro MOTOKI, LDP v3.05
41 .\"
42 .TH SIGRETURN 2 2014\-12\-31 Linux "Linux Programmer's Manual"
43 .SH 名前
44 sigreturn \- シグナルハンドラーから返り、スタックを掃除する
45 .SH 書式
46 \fBint sigreturn(...);\fP
47 .SH 説明
48 .\" See arch/x86/kernel/signal.c::__setup_frame() [in 3.17 source code]
49 Linux カーネルがプロセスに対してブロックされていないシグナルが処理待ちと判定した場合、 そのプロセスの次回のユーザーモードへの遷移
50 (すなわち、システムコールからのリターン時やそのプロセスが CPU に再スケジュールされる際)、 カーネルはプロセスコンテキストの種々の値
51 (プロセッサーのステータスワード、 レジスタ、 シグナルマスク、 シグナルスタック設定) をユーザー空間のスタックに保存する。
52
53 また、 カーネルは、 ユーザーモードへの遷移時にシグナルハンドラーが呼び出され、 ハンドラーからのリターン時に、 制御が "signal
54 trampoline" と呼ばれるユーザー空間コードブロックに渡されるように、準備を行う。 signal trampoline のコードが
55 \fBsigreturn\fP() を呼び出す。
56
57 \fBsigreturn\fP()  は、シグナルハンドラを起動するために行ったことの全て \(em プロセスのシグナルマスクの変更、
58 シグナルスタックの切り替え (\fBsigaltstack\fP(2)  参照) \(em の取り消しを行う。 プロセスのシグナルマスクの復元、
59 スタックの切り替え、 プロセスのコンテキスト (プロセッサフラグ、 レジスタ (スタックポインター、 命令ポインターを含む)) の復元を行い、
60 プロセスがシグナルにより割り込まれた場所から実行を再開できるようにする。
61 .SH 返り値
62 \fBsigreturn\fP()  が返ることはない。
63 .SH 準拠
64 多くの UNIX 系のシステムには \fBsigreturn\fP() システムコールか似たようなシステムコールがある。 しかしながら、 このシステムコールは
65 POSIX には規定されておらず、 その動作の詳細はシステムにより異なる。
66 .SH 注意
67 \fBsigreturn\fP() はシグナルハンドラーを実装するためだけに存在している。 これらを直接呼び出すのは\fB決して\fP行うべきではない。
68 \fBsigreturn\fP() に渡される引き数の詳細はアーキテクチャーにより異なる。
69
70 .\" See, for example, sysdeps/unix/sysv/linux/i386/sigaction.c and
71 .\" sysdeps/unix/sysv/linux/x86_64/sigaction.c in the glibc (2.20) source.
72 かつて、 UNIX システムでは signal trampoline コードがユーザースタックに置かれていた。 今日では、
73 ユーザースタックのページは保護され、 コードの実行は禁止されている。 したがって、 現代の Linux システムでは、 アーキテクチャー依存ではあるが、
74 signal trampoline コードは \fBvdso\fP(7) 内もしくは C ライブラリ内に置かれる。 後者の場合、 C ライブラリは
75 trampoline code の場所を \fBsigaction\fP(2) に渡される \fIsigaction\fP 構造体の \fIsa_restorer\fP
76 フィールドを使って渡し、 \fIsa_flags\fP フィールドの \fBSA_RESTORER\fP フラグをセットする。
77
78 保存されたプロセスコンテキスト情報は \fIucontext_t\fP構造体に置かれる (\fI<sys/ucontext.h>\fP 参照)。
79 この構造体は、 \fBSA_SIGINFO\fP フラグを付けて設定されたシグナルハンドラーの第 3 引き数としてシングルハンドラー内で参照できる。
80
81 他のいくつかの UNIX システムでは、 signal trampoline の扱いは少し異なる。 特に、 いくつかのシステムでは、
82 ユーザーモードに戻る際に、 カーネルは制御を (シグナルハンドラーではなく) trampoline に渡し、 trampoline
83 コードがシグナルハンドラーを呼び出す (その後ハンドラーが返ると \fBsigreturn\fP() を呼び出す)。
84 .SH 関連項目
85 \fBkill\fP(2), \fBrestart_syscall\fP(2), \fBsigaltstack\fP(2), \fBsignal\fP(2),
86 \fBgetcontext\fP(3), \fBsignal\fP(7)
87 .SH この文書について
88 この man ページは Linux \fIman\-pages\fP プロジェクトのリリース 3.77 の一部である。
89 プロジェクトの説明とバグ報告に関する情報は \%http://www.kernel.org/doc/man\-pages/ に書かれている。