1 .\" Hey Emacs! This file is -*- nroff -*- source.
3 .\" Copyright (C) 2003 Andi Kleen
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.
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.
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
22 .\" Formatted or processed versions of this manual, if unaccompanied by
23 .\" the source, must acknowledge the copyright and authors of this work.
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
31 .TH ARCH_PRCTL 2 2007-12-26 "Linux" "Linux Programmer's Manual"
34 .\"O arch_prctl \- set architecture-specific thread state
35 arch_prctl \- ¥¢¡¼¥¥Æ¥¯¥Á¥ã¸ÇͤΥ¹¥ì¥Ã¥É¾õÂÖ¤òÀßÄꤹ¤ë
39 .B #include <asm/prctl.h>
41 .B #include <sys/prctl.h>
43 .BI "int arch_prctl(int " code ", unsigned long *" addr );
48 .\"O .BR arch_prctl ()
49 .\"O function sets architecture-specific process or thread state.
51 ´Ø¿ô¤Ï¥¢¡¼¥¥Æ¥¯¥Á¥ã¸ÇÍ¤Î¥×¥í¥»¥¹¾õÂÖ¤Þ¤¿¤Ï¥¹¥ì¥Ã¥É¾õÂÖ¤òÀßÄꤹ¤ë¡£
53 .\"O selects a subfunction
54 .\"O and passes argument
58 .\"O is interpreted as either an
59 .\"O .I "unsigned long"
60 .\"O for the "set" operations, or as an
61 .\"O .IR "unsigned long *" ,
62 .\"O for the "get" operations.
64 ¤ÏÉûµ¡Ç½¤òÁªÂò¤·¡¢°ú¤¿ô
70 ¤È¤·¤Æ¡¢"get" Áàºî¤Ç¤Ï
74 .\"O Sub functions for x86-64 are:
75 x86-64 ¤ÎÉûµ¡Ç½¤Ï°Ê²¼¤ÎÄ̤ê:
78 .\"O Set the 64-bit base for the
83 ¥ì¥¸¥¹¥¿¤Î 64 ¥Ó¥Ã¥È¥Ù¡¼¥¹¤ò
88 .\"O Return the 64-bit base value for the
90 .\"O register of the current thread in the
96 ¥ì¥¸¥¹¥¿¤Î 64 ¥Ó¥Ã¥È¥Ù¡¼¥¹Ãͤò¡¢
103 .\"O Set the 64-bit base for the
108 ¥ì¥¸¥¹¥¿¤Î 64 ¥Ó¥Ã¥È¥Ù¡¼¥¹¤ò
113 .\"O Return the 64-bit base value for the
115 .\"O register of the current thread in the
116 .\"O .I unsigned long
121 ¥ì¥¸¥¹¥¿¤Î 64 ¥Ó¥Ã¥È¥Ù¡¼¥¹Ãͤò¡¢
126 .\"O .SH RETURN VALUE
129 .\"O .BR arch_prctl ()
130 .\"O returns 0; on error, \-1 is returned, and
132 .\"O is set to indicate the error.
135 ¤Ï 0 ¤òÊÖ¤¹¡£¥¨¥é¡¼¤Î¾ì¹ç¡¢\-1 ¤òÊÖ¤·¡¢
137 ¤ò¥¨¥é¡¼¤ò¼¨¤¹ÃͤËÀßÄꤹ¤ë¡£
143 .\"O points to an unmapped address or is outside the process address space.
145 ¤¬¥¢¥ó¥Þ¥Ã¥×¤µ¤ì¤¿¥¢¥É¥ì¥¹¤ò»Ø¤·¤Æ¤¤¤ë¤«¡¢¥×¥í¥»¥¹¤Î¥¢¥É¥ì¥¹¶õ´Ö¤Î³°¤Ë¤¢¤ë¡£
149 .\"O is not a valid subcommand.
151 ¤¬Í¸ú¤Ê¥µ¥Ö¥³¥Þ¥ó¥É¤Ç¤Ê¤¤¡£
155 .\"O is outside the process address space.
157 ¤¬¥×¥í¥»¥¹¤Î¥¢¥É¥ì¥¹¶õ´Ö¤Î³°¤Ë¤¢¤ë¡£
160 .\"O .\" Man page written by Andi Kleen.
161 .\" ¤³¤Î man ¥Ú¡¼¥¸¤Ï Andi Kleen ¤Ë¤è¤Ã¤Æ½ñ¤«¤ì¤¿¡£
162 .\"O .SH "CONFORMING TO"
164 .\"O .BR arch_prctl ()
165 .\"O is a Linux/x86-64 extension and should not be used in programs intended
168 ¤Ï Linux/x86-64 ³ÈÄ¥¤Ç¤¢¤ê¡¢°Ü¿¢À¤ò°Õ¿Þ¤·¤¿¥×¥í¥°¥é¥à¤Ç¤Ï»È¤¦¤Ù¤¤Ç¤Ê¤¤¡£
171 .\"O .BR arch_prctl ()
172 .\"O is only supported on Linux/x86-64 for 64-bit programs currently.
174 ¤Ï¸½ºß¤Î¤È¤³¤í Linux/x86-64 ¾å¤Î 64 ¥Ó¥Ã¥È¥×¥í¥°¥é¥à¤Ç¤Î¤ß¥µ¥Ý¡¼¥È¤µ¤ì¤Æ¤¤¤ë¡£
176 .\"O The 64-bit base changes when a new 32-bit segment selector is loaded.
177 ¿·¤·¤¤ 32 ¥Ó¥Ã¥È¥»¥°¥á¥ó¥È¥»¥ì¥¯¥¿¤¬¥í¡¼¥É¤µ¤ì¤¿¾ì¹ç¡¢
178 64 ¥Ó¥Ã¥È¥Ù¡¼¥¹¤ÏÊѹ¹¤µ¤ì¤ë¡£
181 .\"O is disabled in some kernels.
183 ¤¬Ìµ¸ú¤Ë¤µ¤ì¤Æ¤¤¤ë¥«¡¼¥Í¥ë¤â¤¢¤ë¡£
185 .\"O Context switches for 64-bit segment bases are rather expensive.
186 .\"O It may be a faster alternative to set a 32-bit base using a
187 .\"O segment selector by setting up an LDT with
188 .\"O .BR modify_ldt (2)
190 .\"O .BR set_thread_area (2)
191 .\"O system call in kernel 2.5 or later.
192 64 ¥Ó¥Ã¥È¥»¥°¥á¥ó¥È¥Ù¡¼¥¹¤Î¥³¥ó¥Æ¥¥¹¥È¥¹¥¤¥Ã¥Á¤Ï¡¢¤ä¤ä¹â²Á¤Ç¤¢¤ë¡£
195 ¤ÇÀßÄꤷ¤Æ¥»¥°¥á¥ó¥È¥»¥ì¥¯¥¿¤ò»È¤¦¤«¡¢
196 (¥«¡¼¥Í¥ë 2.5 °Ê¹ß¤Î)
197 .BR set_thread_area (2)
198 ¥·¥¹¥Æ¥à¥³¡¼¥ë¤ò»È¤¦¤³¤È¤Ë¤è¤ê¡¢
199 32 ¥Ó¥Ã¥È¥Ù¡¼¥¹¤òÀßÄꤹ¤ë¤È¤¤¤¦¹â®¤ÊÂåÂؼêÃʤ⤢¤ë¡£
200 .\"O .BR arch_prctl ()
201 .\"O is only needed when you want to set bases that are larger than 4GB.
202 4GB ¤è¤êÂ礤ʥ١¼¥¹¤òÀßÄꤷ¤¿¤¤¾ì¹ç¤Ë¤Î¤ß¡¢
205 .\"O Memory in the first 2GB of address space can be allocated by using
210 ¥¢¥É¥ì¥¹¶õ´Ö¤ÎºÇ½é¤Î 2GB ¤Ë¤¢¤ë¥á¥â¥ê¤Ï¡¢
214 ¥Õ¥é¥°¤ò»ØÄꤷ¤Æ³ä¤êÅö¤Æ¤ë¤³¤È¤¬¤Ç¤¤ë¡£
216 .\"O As of version 2.7, glibc provides no prototype for
217 .\"O .BR arch_prctl ().
218 .\"O You have to declare it yourself for now.
219 .\"O This may be fixed in future glibc versions.
220 ¥Ð¡¼¥¸¥ç¥ó 2.7 »þÅÀ¤Ç¤Ï¡¢glibc ¤Ë¤Ï
222 ¤Î¥×¥í¥È¥¿¥¤¥×¤¬¤Ê¤¤¡£
223 º£¤Î¤È¤³¤í¥æ¡¼¥¶¤Ï¼«Ê¬¼«¿È¤ÇÀë¸À¤¹¤ëɬÍפ¬¤¢¤ë¡£
224 ¤³¤ì¤Ï¾Íè¤Î glibc ¤Î¥Ð¡¼¥¸¥ç¥ó¤Ç½¤Àµ¤µ¤ì¤ë¤«¤â¤·¤ì¤Ê¤¤¡£
227 .\"O may be already used by the threading library.
229 ¤Ï¥¹¥ì¥Ã¥É¥é¥¤¥Ö¥é¥ê¤Ç´û¤Ë»È¤ï¤ì¤Æ¤¤¤ë¤«¤â¤·¤ì¤Ê¤¤¡£
235 .BR set_thread_area (2)
237 AMD X86-64 Programmer's manual