OSDN Git Service

(split) Convert release and draft pages to UTF-8.
[linuxjm/LDP_man-pages.git] / release / man2 / arch_prctl.2
1 .\" Hey Emacs! This file is -*- nroff -*- source.
2 .\"
3 .\" Copyright (C) 2003 Andi Kleen
4 .\"
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 .\"
25 .\" Japanese Version Copyright (c) 2004 Yuichi SATO
26 .\"         all rights reserved.
27 .\" Translated 2004-06-08, Yuichi SATO <ysato444@yahoo.co.jp>
28 .\" Updated 2005-11-19, Akihiro MOTOKI <amotoki@dd.iij4u.or.jp>
29 .\" Updated 2008-02-10, Akihiro MOTOKI <amotoki@dd.iij4u.or.jp>, LDP v2.77
30 .\"
31 .TH ARCH_PRCTL 2 2007-12-26 "Linux" "Linux Programmer's Manual"
32 .SH 名前
33 arch_prctl \- アーキテクチャ固有のスレッド状態を設定する
34 .SH 書式
35 .nf
36 .B #include <asm/prctl.h>
37 .br
38 .B #include <sys/prctl.h>
39 .sp
40 .BI "int arch_prctl(int " code ", unsigned long *" addr );
41 .fi
42 .SH 説明
43 .BR arch_prctl ()
44 関数はアーキテクチャ固有のプロセス状態またはスレッド状態を設定する。
45 .I code
46 は副機能を選択し、引き数
47 .I addr
48 を副機能に渡す。
49 .I addr
50 は、"set" 操作では
51 .I "unsigned long"
52 として、"get" 操作では
53 .I "unsigned long *"
54 として解釈される。
55 .LP
56 x86-64 の副機能は以下の通り:
57 .TP
58 .B ARCH_SET_FS
59 .I FS
60 レジスタの 64 ビットベースを
61 .I addr
62 に設定する。
63 .TP
64 .B ARCH_GET_FS
65 現在のスレッドの
66 .I FS
67 レジスタの 64 ビットベース値を、
68 .I addr
69 が指す
70 .I unsigned long
71 の領域に格納する。
72 .TP
73 .B ARCH_SET_GS
74 .I GS
75 レジスタの 64 ビットベースを
76 .I addr
77 に設定する。
78 .TP
79 .B ARCH_GET_GS
80 現在のスレッドの
81 .I GS
82 レジスタの 64 ビットベース値を、
83 .I addr
84 が指す
85 .I unsigned long
86 の領域に格納する。
87 .SH 返り値
88 成功すると、
89 .BR arch_prctl ()
90 は 0 を返す。エラーの場合、\-1 を返し、
91 .I errno
92 をエラーを示す値に設定する。
93 .SH エラー
94 .TP
95 .B EFAULT
96 .I addr
97 がアンマップされたアドレスを指しているか、プロセスのアドレス空間の外にある。
98 .TP
99 .B EINVAL
100 .I code
101 が有効なサブコマンドでない。
102 .TP
103 .B EPERM
104 .I addr
105 がプロセスのアドレス空間の外にある。
106 .\" .SH 著者
107 .\" この man ページは Andi Kleen によって書かれた。
108 .SH 準拠
109 .BR arch_prctl ()
110 は Linux/x86-64 拡張であり、移植性を意図したプログラムでは使うべきでない。
111 .SH 注意
112 .BR arch_prctl ()
113 は現在のところ Linux/x86-64 上の 64 ビットプログラムでのみサポートされている。
114
115 新しい 32 ビットセグメントセレクタがロードされた場合、
116 64 ビットベースは変更される。
117
118 .B ARCH_SET_GS
119 が無効にされているカーネルもある。
120
121 64 ビットセグメントベースのコンテキストスイッチは、やや高価である。
122 LDT を
123 .BR modify_ldt (2)
124 で設定してセグメントセレクタを使うか、
125 (カーネル 2.5 以降の)
126 .BR set_thread_area (2)
127 システムコールを使うことにより、
128 32 ビットベースを設定するという高速な代替手段もある。
129 4GB より大きなベースを設定したい場合にのみ、
130 .BR arch_prctl ()
131 が必要である。
132 アドレス空間の最初の 2GB にあるメモリは、
133 .BR mmap (2)
134
135 .B MAP_32BIT
136 フラグを指定して割り当てることができる。
137
138 バージョン 2.7 時点では、glibc には
139 .BR arch_prctl ()
140 のプロトタイプがない。
141 今のところユーザは自分自身で宣言する必要がある。
142 これは将来の glibc のバージョンで修正されるかもしれない。
143
144 .I FS
145 はスレッドライブラリで既に使われているかもしれない。
146 .SH 関連項目
147 .BR mmap (2),
148 .BR modify_ldt (2),
149 .BR prctl (2),
150 .BR set_thread_area (2)
151 .sp
152 AMD X86-64 Programmer's manual