mirror of https://github.com/mkerrisk/man-pages
modify_ldt.2: Minor tweaks to Andy Lutomirski's patch
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
This commit is contained in:
parent
14620a2531
commit
7acf749e4f
|
@ -29,14 +29,15 @@ modify_ldt \- get or set a per-process LDT entry
|
|||
.nf
|
||||
.B #include <sys/types.h>
|
||||
.sp
|
||||
.BI "int modify_ldt(int " "func" ", void *" "ptr" ", unsigned long " "bytecount" );
|
||||
.BI "int modify_ldt(int " func ", void *" ptr ", unsigned long " bytecount );
|
||||
.fi
|
||||
.PP
|
||||
.IR Note :
|
||||
There is no glibc wrapper for this system call; see NOTES.
|
||||
.SH DESCRIPTION
|
||||
.BR modify_ldt ()
|
||||
reads or writes the local descriptor table (LDT) for a process. The LDT
|
||||
reads or writes the local descriptor table (LDT) for a process.
|
||||
The LDT
|
||||
is an array of segment descriptors that can be referenced by user code.
|
||||
Linux allows processes to configure a per-process (actually per-mm) LDT.
|
||||
For more information about the LDT, see the Intel Software Developer's
|
||||
|
@ -51,7 +52,8 @@ reads the LDT into the memory pointed to by
|
|||
The number of bytes read is the smaller of
|
||||
.I bytecount
|
||||
and the actual size of the LDT, although the kernel may act as though
|
||||
the LDT is padded with additional trailing zero bytes. On success,
|
||||
the LDT is padded with additional trailing zero bytes.
|
||||
On success,
|
||||
.BR modify_ldt ()
|
||||
will return the number of bytes read.
|
||||
.PP
|
||||
|
@ -60,7 +62,7 @@ When
|
|||
is 1 or 0x11,
|
||||
.BR modify_ldt ()
|
||||
modifies the LDT entry indicated by
|
||||
.I ptr\->entry_number.
|
||||
.IR ptr\->entry_number .
|
||||
.I ptr
|
||||
points to a
|
||||
.I user_desc
|
||||
|
@ -95,8 +97,8 @@ In Linux 2.4 and earlier, this structure was named
|
|||
The
|
||||
.I contents
|
||||
field is the segment type (data, expand-down data, non-conforming code, or
|
||||
conforming code). The other fields match their descriptions in the
|
||||
CPU manual, although
|
||||
conforming code).
|
||||
The other fields match their descriptions in the CPU manual, although
|
||||
.BR modify_ldt ()
|
||||
cannot set the accessed bit.
|
||||
.PP
|
||||
|
@ -128,7 +130,8 @@ When
|
|||
.I func
|
||||
is 2,
|
||||
.BR modify_ldt ()
|
||||
will read zeros. This appears to be a leftover from Linux 2.4.
|
||||
will read zeros.
|
||||
This appears to be a leftover from Linux 2.4.
|
||||
.SH RETURN VALUE
|
||||
On success,
|
||||
.BR modify_ldt ()
|
||||
|
@ -156,7 +159,7 @@ is not equal to the size of the structure
|
|||
.IR user_desc ,
|
||||
or
|
||||
.I func
|
||||
is 1 or 0x11 and the new ldt entry has invalid values.
|
||||
is 1 or 0x11 and the new LDT entry has invalid values.
|
||||
.TP
|
||||
.B ENOSYS
|
||||
.I func
|
||||
|
@ -164,18 +167,14 @@ is neither 0, 1, 2, nor 0x11.
|
|||
.SH CONFORMING TO
|
||||
This call is Linux-specific and should not be used in programs intended
|
||||
to be portable.
|
||||
.SH BUGS
|
||||
On 64-bit kernels before Linux 3.19, one of the padding bits in
|
||||
.I user_desc,
|
||||
if set, would prevent the descriptor from being considered empty.
|
||||
.SH NOTES
|
||||
Glibc does not provide a wrapper for this system call; call it using
|
||||
.BR syscall (2).
|
||||
.PP
|
||||
.BR modify_ldt ()
|
||||
should not be used for thread-local storage, as it slows down context
|
||||
switches and only supports a limited number of threads. Threading libraries
|
||||
should use
|
||||
switches and only supports a limited number of threads.
|
||||
Threading libraries should use
|
||||
.BR set_thread_area (2)
|
||||
or
|
||||
.BR arch_prctl (2)
|
||||
|
@ -184,9 +183,13 @@ calls.
|
|||
.PP
|
||||
The normal use for
|
||||
.BR modify_ldt (2)
|
||||
is to run legacy 16-bit or segmented 32-bit code. Not all kernels allow
|
||||
16-bit segments to be installed, however.
|
||||
is to run legacy 16-bit or segmented 32-bit code.
|
||||
Not all kernels allow 16-bit segments to be installed, however.
|
||||
.SH BUGS
|
||||
On 64-bit kernels before Linux 3.19, one of the padding bits in
|
||||
.IR user_desc ,
|
||||
if set, would prevent the descriptor from being considered empty.
|
||||
.SH SEE ALSO
|
||||
.BR set_thread_area (2),
|
||||
.BR arch_prctl (2),
|
||||
.BR set_thread_area (2),
|
||||
.BR vm86 (2)
|
||||
|
|
Loading…
Reference in New Issue