2004-11-03 13:51:07 +00:00
|
|
|
.\" Hey Emacs! This file is -*- nroff -*- source.
|
|
|
|
.\"
|
|
|
|
.\" Copyright (c) 1995 Michael Chastain (mec@duracef.shout.net), 22 July 1995.
|
|
|
|
.\"
|
|
|
|
.\" This is free documentation; you can redistribute it and/or
|
|
|
|
.\" modify it under the terms of the GNU General Public License as
|
|
|
|
.\" published by the Free Software Foundation; either version 2 of
|
|
|
|
.\" the License, or (at your option) any later version.
|
|
|
|
.\"
|
|
|
|
.\" The GNU General Public License's references to "object code"
|
|
|
|
.\" and "executables" are to be interpreted as the output of any
|
|
|
|
.\" document formatting or typesetting system, including
|
|
|
|
.\" intermediate and printed output.
|
|
|
|
.\"
|
|
|
|
.\" This manual is distributed in the hope that it will be useful,
|
|
|
|
.\" but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
.\" MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
|
|
.\" GNU General Public License for more details.
|
|
|
|
.\"
|
|
|
|
.\" You should have received a copy of the GNU General Public
|
|
|
|
.\" License along with this manual; if not, write to the Free
|
|
|
|
.\" Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111,
|
|
|
|
.\" USA.
|
|
|
|
.\"
|
|
|
|
.TH MODIFY_LDT 2 1995-07-22 "Linux 1.3.6" "Linux Programmer's Manual"
|
|
|
|
.SH NAME
|
|
|
|
modify_ldt \- get or set ldt
|
|
|
|
.SH SYNOPSIS
|
2006-03-16 00:50:08 +00:00
|
|
|
.nf
|
2004-12-10 09:03:08 +00:00
|
|
|
.B #include <sys/types.h>
|
2004-11-03 13:51:07 +00:00
|
|
|
.br
|
|
|
|
.B #include <linux/unistd.h>
|
2004-12-10 09:03:08 +00:00
|
|
|
.br
|
|
|
|
.B #include <errno.h>
|
2004-11-03 13:51:07 +00:00
|
|
|
.sp
|
2006-03-16 00:50:08 +00:00
|
|
|
.BI "_syscall3(int, modify_ldt, int, " func ", void *, " ptr ,
|
|
|
|
.BI " unsigned long, " bytecount )
|
|
|
|
/* Using \fBsyscall\fP(2) may be preferable; see \fBintro\fP(2) */
|
2004-11-03 13:51:07 +00:00
|
|
|
.sp
|
|
|
|
.BI "int modify_ldt(int " "func" ", void *" "ptr" ", unsigned long " "bytecount" );
|
2006-03-16 00:50:08 +00:00
|
|
|
.fi
|
2004-11-03 13:51:07 +00:00
|
|
|
.SH DESCRIPTION
|
2005-10-19 06:54:38 +00:00
|
|
|
.BR modify_ldt ()
|
2004-11-03 13:51:07 +00:00
|
|
|
reads or writes the local descriptor table (ldt) for a process.
|
|
|
|
The ldt is a per-process memory management table used by the i386 processor.
|
|
|
|
For more information on this table, see an Intel 386 processor handbook.
|
|
|
|
.PP
|
|
|
|
When
|
|
|
|
.I func
|
|
|
|
is 0,
|
2005-10-19 06:54:38 +00:00
|
|
|
.BR modify_ldt ()
|
2004-11-03 13:51:07 +00:00
|
|
|
reads the ldt into the memory pointed to by
|
|
|
|
.IR ptr .
|
|
|
|
The number of bytes read is the smaller of
|
|
|
|
.I bytecount
|
|
|
|
and the actual size of the ldt.
|
|
|
|
.PP
|
|
|
|
When
|
|
|
|
.I func
|
|
|
|
is 1,
|
2005-10-19 06:54:38 +00:00
|
|
|
.BR modify_ldt ()
|
2004-11-03 13:51:07 +00:00
|
|
|
modifies one ldt entry.
|
|
|
|
.I ptr
|
|
|
|
points to a
|
|
|
|
.I modify_ldt_ldt_s
|
|
|
|
structure and
|
|
|
|
.I bytecount
|
|
|
|
must equal the size of this structure.
|
|
|
|
.\" .PP
|
|
|
|
.\" The ldt is specific for the calling process. Any attempts to change
|
|
|
|
.\" the ldt to include the address space of another process or the kernel
|
|
|
|
.\" will result in a segmentation violation when trying to access the memory
|
|
|
|
.\" outside of the process address space. The memory protection is enforced
|
|
|
|
.\" at the paging layer.
|
|
|
|
.SH "RETURN VALUE"
|
|
|
|
On success,
|
2005-10-19 06:54:38 +00:00
|
|
|
.BR modify_ldt ()
|
2004-11-03 13:51:07 +00:00
|
|
|
returns either the actual number of bytes read (for reading)
|
|
|
|
or 0 (for writing).
|
|
|
|
On failure,
|
2005-10-19 06:54:38 +00:00
|
|
|
.BR modify_ldt ()
|
2004-11-03 13:51:07 +00:00
|
|
|
returns \-1 and sets
|
|
|
|
.IR errno .
|
|
|
|
.SH ERRORS
|
|
|
|
.TP
|
|
|
|
.B EFAULT
|
|
|
|
.I ptr
|
|
|
|
points outside the address space.
|
|
|
|
.TP
|
|
|
|
.B EINVAL
|
|
|
|
.I ptr
|
|
|
|
is 0,
|
|
|
|
or
|
|
|
|
.I func
|
|
|
|
is 1 and
|
|
|
|
.I bytecount
|
|
|
|
is not equal to the size of the structure
|
|
|
|
.IR modify_ldt_ldt_s ,
|
|
|
|
or
|
|
|
|
.I func
|
|
|
|
is 1 and the new ldt entry has invalid values.
|
|
|
|
.TP
|
|
|
|
.B ENOSYS
|
|
|
|
.I func
|
|
|
|
is neither 0 nor 1.
|
|
|
|
.SH "CONFORMING TO"
|
2004-12-14 18:39:17 +00:00
|
|
|
This call is Linux-specific and should not be used in programs intended
|
2004-11-03 13:51:07 +00:00
|
|
|
to be portable.
|
|
|
|
.SH "SEE ALSO"
|
|
|
|
.BR vm86 (2)
|