arch_prctl.2: ffix

Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
This commit is contained in:
Michael Kerrisk 2017-08-15 08:58:57 +02:00
parent 558b62055e
commit ceb7e59065
1 changed files with 8 additions and 9 deletions

View File

@ -28,9 +28,8 @@ arch_prctl \- set architecture-specific thread state
.SH SYNOPSIS
.nf
.B #include <asm/prctl.h>
.br
.B #include <sys/prctl.h>
.sp
.PP
.BI "int arch_prctl(int " code ", unsigned long " addr );
.BI "int arch_prctl(int " code ", unsigned long *" addr );
.fi
@ -107,12 +106,12 @@ to be portable.
.SH NOTES
.BR arch_prctl ()
is supported only on Linux/x86-64 for 64-bit programs currently.
.PP
The 64-bit base changes when a new 32-bit segment selector is loaded.
.PP
.B ARCH_SET_GS
is disabled in some kernels.
.PP
Context switches for 64-bit segment bases are rather expensive.
As an optimization, if a 32-bit TLS base address is used,
.BR arch_prctl ()
@ -124,19 +123,19 @@ Memory in the first 2GB of address space can be allocated by using
with the
.B MAP_32BIT
flag.
.PP
Because of the aforementioned optimization, using
.BR arch_prctl ()
and
.BR set_thread_area (2)
in the same thread is dangerous, as they may overwrite each other's
TLS entries.
.PP
As of version 2.7, glibc provides no prototype for
.BR arch_prctl ().
You have to declare it yourself for now.
This may be fixed in future glibc versions.
.PP
.I FS
may be already used by the threading library.
Programs that use
@ -147,5 +146,5 @@ directly are very likely to crash.
.BR modify_ldt (2),
.BR prctl (2),
.BR set_thread_area (2)
.PP
AMD X86-64 Programmer's manual