Mercurial > projects > ldc
comparison druntime/import/stdc/posix/sys/mman.d @ 760:6f33b427bfd1
Seems like hg ignores .di files, so I missed a bunch of stuff. complete druntime should be there now :)
author | Tomas Lindquist Olsen <tomas.l.olsen@gmail.com> |
---|---|
date | Wed, 12 Nov 2008 00:19:18 +0100 |
parents | |
children |
comparison
equal
deleted
inserted
replaced
759:d3eb054172f9 | 760:6f33b427bfd1 |
---|---|
1 /** | |
2 * D header file for POSIX. | |
3 * | |
4 * Copyright: Public Domain | |
5 * License: Public Domain | |
6 * Authors: Sean Kelly | |
7 * Standards: The Open Group Base Specifications Issue 6, IEEE Std 1003.1, 2004 Edition | |
8 */ | |
9 module stdc.posix.sys.mman; | |
10 | |
11 private import stdc.posix.config; | |
12 public import stdc.stddef; // for size_t | |
13 public import stdc.posix.sys.types; // for off_t, mode_t | |
14 | |
15 extern (C): | |
16 | |
17 // | |
18 // Advisory Information (ADV) | |
19 // | |
20 /* | |
21 int posix_madvise(void*, size_t, int); | |
22 */ | |
23 | |
24 // | |
25 // Advisory Information and either Memory Mapped Files or Shared Memory Objects (MC1) | |
26 // | |
27 /* | |
28 POSIX_MADV_NORMAL | |
29 POSIX_MADV_SEQUENTIAL | |
30 POSIX_MADV_RANDOM | |
31 POSIX_MADV_WILLNEED | |
32 POSIX_MADV_DONTNEED | |
33 */ | |
34 | |
35 version( linux ) | |
36 { | |
37 const POSIX_MADV_NORMAL = 0; | |
38 const POSIX_MADV_RANDOM = 1; | |
39 const POSIX_MADV_SEQUENTIAL = 2; | |
40 const POSIX_MADV_WILLNEED = 3; | |
41 const POSIX_MADV_DONTNEED = 4; | |
42 } | |
43 else version( darwin ) | |
44 { | |
45 const POSIX_MADV_NORMAL = 0; | |
46 const POSIX_MADV_RANDOM = 1; | |
47 const POSIX_MADV_SEQUENTIAL = 2; | |
48 const POSIX_MADV_WILLNEED = 3; | |
49 const POSIX_MADV_DONTNEED = 4; | |
50 } | |
51 else version( freebsd ) | |
52 { | |
53 const POSIX_MADV_NORMAL = 0; | |
54 const POSIX_MADV_RANDOM = 1; | |
55 const POSIX_MADV_SEQUENTIAL = 2; | |
56 const POSIX_MADV_WILLNEED = 3; | |
57 const POSIX_MADV_DONTNEED = 4; | |
58 } | |
59 | |
60 // | |
61 // Memory Mapped Files, Shared Memory Objects, or Memory Protection (MC2) | |
62 // | |
63 /* | |
64 PROT_READ | |
65 PROT_WRITE | |
66 PROT_EXEC | |
67 PROT_NONE | |
68 */ | |
69 | |
70 version( linux ) | |
71 { | |
72 const PROT_NONE = 0x0; | |
73 const PROT_READ = 0x1; | |
74 const PROT_WRITE = 0x2; | |
75 const PROT_EXEC = 0x4; | |
76 } | |
77 else version( darwin ) | |
78 { | |
79 const PROT_NONE = 0x00; | |
80 const PROT_READ = 0x01; | |
81 const PROT_WRITE = 0x02; | |
82 const PROT_EXEC = 0x04; | |
83 } | |
84 else version( freebsd ) | |
85 { | |
86 const PROT_NONE = 0x00; | |
87 const PROT_READ = 0x01; | |
88 const PROT_WRITE = 0x02; | |
89 const PROT_EXEC = 0x04; | |
90 } | |
91 | |
92 // | |
93 // Memory Mapped Files, Shared Memory Objects, or Typed Memory Objects (MC3) | |
94 // | |
95 /* | |
96 void* mmap(void*, size_t, int, int, int, off_t); | |
97 int munmap(void*, size_t); | |
98 */ | |
99 | |
100 version( linux ) | |
101 { | |
102 //void* mmap(void*, size_t, int, int, int, off_t); | |
103 int munmap(void*, size_t); | |
104 | |
105 static if( __USE_LARGEFILE64 ) | |
106 { | |
107 void* mmap64(void*, size_t, int, int, int, off_t); | |
108 alias mmap64 mmap; | |
109 } | |
110 else | |
111 { | |
112 void* mmap(void*, size_t, int, int, int, off_t); | |
113 } | |
114 } | |
115 else version( darwin ) | |
116 { | |
117 void* mmap(void*, size_t, int, int, int, off_t); | |
118 int munmap(void*, size_t); | |
119 } | |
120 else version( freebsd ) | |
121 { | |
122 void* mmap(void*, size_t, int, int, int, off_t); | |
123 int munmap(void*, size_t); | |
124 } | |
125 | |
126 // | |
127 // Memory Mapped Files (MF) | |
128 // | |
129 /* | |
130 MAP_SHARED (MF|SHM) | |
131 MAP_PRIVATE (MF|SHM) | |
132 MAP_FIXED (MF|SHM) | |
133 MAP_FAILED (MF|SHM) | |
134 | |
135 MS_ASYNC (MF|SIO) | |
136 MS_SYNC (MF|SIO) | |
137 MS_INVALIDATE (MF|SIO) | |
138 | |
139 int msync(void*, size_t, int); (MF|SIO) | |
140 */ | |
141 | |
142 version( linux ) | |
143 { | |
144 const MAP_SHARED = 0x01; | |
145 const MAP_PRIVATE = 0x02; | |
146 const MAP_FIXED = 0x10; | |
147 const MAP_ANON = 0x20; // non-standard | |
148 | |
149 const MAP_FAILED = cast(void*) -1; | |
150 | |
151 enum | |
152 { | |
153 MS_ASYNC = 1, | |
154 MS_SYNC = 4, | |
155 MS_INVALIDATE = 2 | |
156 } | |
157 | |
158 int msync(void*, size_t, int); | |
159 } | |
160 else version( darwin ) | |
161 { | |
162 const MAP_SHARED = 0x0001; | |
163 const MAP_PRIVATE = 0x0002; | |
164 const MAP_FIXED = 0x0010; | |
165 const MAP_ANON = 0x1000; // non-standard | |
166 | |
167 const MAP_FAILED = cast(void*)-1; | |
168 | |
169 const MS_ASYNC = 0x0001; | |
170 const MS_INVALIDATE = 0x0002; | |
171 const MS_SYNC = 0x0010; | |
172 | |
173 int msync(void*, size_t, int); | |
174 } | |
175 else version( freebsd ) | |
176 { | |
177 const MAP_SHARED = 0x0001; | |
178 const MAP_PRIVATE = 0x0002; | |
179 const MAP_FIXED = 0x0010; | |
180 const MAP_ANON = 0x1000; // non-standard | |
181 | |
182 const MAP_FAILED = cast(void*)-1; | |
183 | |
184 const MS_SYNC = 0x0000; | |
185 const MS_ASYNC = 0x0001; | |
186 const MS_INVALIDATE = 0x0002; | |
187 | |
188 int msync(void*, size_t, int); | |
189 } | |
190 | |
191 // | |
192 // Process Memory Locking (ML) | |
193 // | |
194 /* | |
195 MCL_CURRENT | |
196 MCL_FUTURE | |
197 | |
198 int mlockall(int); | |
199 int munlockall(); | |
200 */ | |
201 | |
202 version( linux ) | |
203 { | |
204 const MCL_CURRENT = 1; | |
205 const MCL_FUTURE = 2; | |
206 | |
207 int mlockall(int); | |
208 int munlockall(); | |
209 | |
210 } | |
211 else version( darwin ) | |
212 { | |
213 const MCL_CURRENT = 0x0001; | |
214 const MCL_FUTURE = 0x0002; | |
215 | |
216 int mlockall(int); | |
217 int munlockall(); | |
218 } | |
219 else version( freebsd ) | |
220 { | |
221 const MCL_CURRENT = 0x0001; | |
222 const MCL_FUTURE = 0x0002; | |
223 | |
224 int mlockall(int); | |
225 int munlockall(); | |
226 } | |
227 | |
228 // | |
229 // Range Memory Locking (MLR) | |
230 // | |
231 /* | |
232 int mlock(in void*, size_t); | |
233 int munlock(in void*, size_t); | |
234 */ | |
235 | |
236 version( linux ) | |
237 { | |
238 int mlock(in void*, size_t); | |
239 int munlock(in void*, size_t); | |
240 } | |
241 else version( darwin ) | |
242 { | |
243 int mlock(in void*, size_t); | |
244 int munlock(in void*, size_t); | |
245 } | |
246 else version( freebsd ) | |
247 { | |
248 int mlock(in void*, size_t); | |
249 int munlock(in void*, size_t); | |
250 } | |
251 | |
252 // | |
253 // Memory Protection (MPR) | |
254 // | |
255 /* | |
256 int mprotect(void*, size_t, int); | |
257 */ | |
258 | |
259 version( darwin ) | |
260 { | |
261 int mprotect(void*, size_t, int); | |
262 } | |
263 else version( freebsd ) | |
264 { | |
265 int mprotect(void*, size_t, int); | |
266 } | |
267 | |
268 // | |
269 // Shared Memory Objects (SHM) | |
270 // | |
271 /* | |
272 int shm_open(in char*, int, mode_t); | |
273 int shm_unlink(in char*); | |
274 */ | |
275 | |
276 version( linux ) | |
277 { | |
278 int shm_open(in char*, int, mode_t); | |
279 int shm_unlink(in char*); | |
280 } | |
281 else version( darwin ) | |
282 { | |
283 int shm_open(in char*, int, mode_t); | |
284 int shm_unlink(in char*); | |
285 } | |
286 else version( freebsd ) | |
287 { | |
288 int shm_open(in char*, int, mode_t); | |
289 int shm_unlink(in char*); | |
290 } | |
291 | |
292 // | |
293 // Typed Memory Objects (TYM) | |
294 // | |
295 /* | |
296 POSIX_TYPED_MEM_ALLOCATE | |
297 POSIX_TYPED_MEM_ALLOCATE_CONTIG | |
298 POSIX_TYPED_MEM_MAP_ALLOCATABLE | |
299 | |
300 struct posix_typed_mem_info | |
301 { | |
302 size_t posix_tmi_length; | |
303 } | |
304 | |
305 int posix_mem_offset(in void*, size_t, off_t *, size_t *, int *); | |
306 int posix_typed_mem_get_info(int, struct posix_typed_mem_info *); | |
307 int posix_typed_mem_open(in char*, int, int); | |
308 */ |