]>
Commit | Line | Data |
---|---|---|
fea681da MK |
1 | .\" Copyright (c) 1995 Michael Chastain (mec@duracef.shout.net), 22 July 1995. |
2 | .\" | |
6a8d8745 | 3 | .\" %%%LICENSE_START(GPLv2+_doc_full) |
fea681da MK |
4 | .\" This is free documentation; you can redistribute it and/or |
5 | .\" modify it under the terms of the GNU General Public License as | |
6 | .\" published by the Free Software Foundation; either version 2 of | |
7 | .\" the License, or (at your option) any later version. | |
8 | .\" | |
9 | .\" The GNU General Public License's references to "object code" | |
10 | .\" and "executables" are to be interpreted as the output of any | |
11 | .\" document formatting or typesetting system, including | |
12 | .\" intermediate and printed output. | |
13 | .\" | |
14 | .\" This manual is distributed in the hope that it will be useful, | |
15 | .\" but WITHOUT ANY WARRANTY; without even the implied warranty of | |
16 | .\" MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | |
17 | .\" GNU General Public License for more details. | |
18 | .\" | |
19 | .\" You should have received a copy of the GNU General Public | |
c715f741 MK |
20 | .\" License along with this manual; if not, see |
21 | .\" <http://www.gnu.org/licenses/>. | |
6a8d8745 | 22 | .\" %%%LICENSE_END |
fea681da | 23 | .\" |
45c99e3e | 24 | .TH MODIFY_LDT 2 2012-07-13 "Linux" "Linux Programmer's Manual" |
fea681da MK |
25 | .SH NAME |
26 | modify_ldt \- get or set ldt | |
27 | .SH SYNOPSIS | |
16718a1c | 28 | .nf |
527d9933 | 29 | .B #include <sys/types.h> |
fea681da MK |
30 | .sp |
31 | .BI "int modify_ldt(int " "func" ", void *" "ptr" ", unsigned long " "bytecount" ); | |
16718a1c | 32 | .fi |
45c99e3e MK |
33 | |
34 | .IR Note : | |
35 | There is no glibc wrapper for this system call; see NOTES. | |
fea681da | 36 | .SH DESCRIPTION |
e511ffb6 | 37 | .BR modify_ldt () |
fea681da MK |
38 | reads or writes the local descriptor table (ldt) for a process. |
39 | The ldt is a per-process memory management table used by the i386 processor. | |
40 | For more information on this table, see an Intel 386 processor handbook. | |
41 | .PP | |
42 | When | |
43 | .I func | |
44 | is 0, | |
e511ffb6 | 45 | .BR modify_ldt () |
fea681da MK |
46 | reads the ldt into the memory pointed to by |
47 | .IR ptr . | |
48 | The number of bytes read is the smaller of | |
49 | .I bytecount | |
50 | and the actual size of the ldt. | |
51 | .PP | |
52 | When | |
53 | .I func | |
54 | is 1, | |
e511ffb6 | 55 | .BR modify_ldt () |
fea681da MK |
56 | modifies one ldt entry. |
57 | .I ptr | |
58 | points to a | |
5a16bf48 MK |
59 | .I user_desc |
60 | structure | |
61 | and | |
fea681da MK |
62 | .I bytecount |
63 | must equal the size of this structure. | |
5a16bf48 | 64 | .\" |
0e1ad98c | 65 | .\" FIXME ? say something about func == 2 and func == 0x11? |
5a16bf48 MK |
66 | .\" In Linux 2.4, func == 2 returned "the default ldt" |
67 | .\" In Linux 2.6, func == 2 is a nop, returning a zeroed out structure. | |
68 | .\" Linux 2.4 and 2.6 implement an operation for func == 0x11 | |
69 | ||
70 | The | |
71 | .I user_desc | |
c84371c6 | 72 | structure is defined in \fI<asm/ldt.h>\fP as: |
088a639b | 73 | .in +4n |
5a16bf48 MK |
74 | .nf |
75 | ||
76 | struct user_desc { | |
77 | unsigned int entry_number; | |
78 | unsigned long base_addr; | |
79 | unsigned int limit; | |
80 | unsigned int seg_32bit:1; | |
81 | unsigned int contents:2; | |
82 | unsigned int read_exec_only:1; | |
83 | unsigned int limit_in_pages:1; | |
84 | unsigned int seg_not_present:1; | |
85 | unsigned int useable:1; | |
86 | }; | |
87 | .fi | |
88 | .in | |
89 | .PP | |
90 | In Linux 2.4 and earlier, this structure was named | |
91 | .IR modify_ldt_ldt_s . | |
fea681da MK |
92 | .\" .PP |
93 | .\" The ldt is specific for the calling process. Any attempts to change | |
94 | .\" the ldt to include the address space of another process or the kernel | |
95 | .\" will result in a segmentation violation when trying to access the memory | |
96 | .\" outside of the process address space. The memory protection is enforced | |
97 | .\" at the paging layer. | |
47297adb | 98 | .SH RETURN VALUE |
fea681da | 99 | On success, |
e511ffb6 | 100 | .BR modify_ldt () |
fea681da MK |
101 | returns either the actual number of bytes read (for reading) |
102 | or 0 (for writing). | |
103 | On failure, | |
e511ffb6 | 104 | .BR modify_ldt () |
fea681da | 105 | returns \-1 and sets |
0daa9e92 | 106 | .I errno |
5a16bf48 | 107 | to indicate the error. |
fea681da MK |
108 | .SH ERRORS |
109 | .TP | |
110 | .B EFAULT | |
111 | .I ptr | |
112 | points outside the address space. | |
113 | .TP | |
114 | .B EINVAL | |
115 | .I ptr | |
116 | is 0, | |
117 | or | |
118 | .I func | |
119 | is 1 and | |
120 | .I bytecount | |
121 | is not equal to the size of the structure | |
122 | .IR modify_ldt_ldt_s , | |
123 | or | |
124 | .I func | |
125 | is 1 and the new ldt entry has invalid values. | |
126 | .TP | |
127 | .B ENOSYS | |
128 | .I func | |
129 | is neither 0 nor 1. | |
47297adb | 130 | .SH CONFORMING TO |
8382f16d | 131 | This call is Linux-specific and should not be used in programs intended |
fea681da | 132 | to be portable. |
c12fd10d MK |
133 | .SH NOTES |
134 | Glibc does not provide a wrapper for this system call; call it using | |
135 | .BR syscall (2). | |
47297adb | 136 | .SH SEE ALSO |
fea681da | 137 | .BR vm86 (2) |