comparison tango/tango/stdc/posix/sys/mman.d @ 132:1700239cab2e trunk

[svn r136] MAJOR UNSTABLE UPDATE!!! Initial commit after moving to Tango instead of Phobos. Lots of bugfixes... This build is not suitable for most things.
author lindquist
date Fri, 11 Jan 2008 17:57:40 +0100
parents
children
comparison
equal deleted inserted replaced
131:5825d48b27d1 132:1700239cab2e
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 tango.stdc.posix.sys.mman;
10
11 public import tango.stdc.stddef; // for size_t
12 public import tango.stdc.posix.sys.types; // for off_t, mode_t
13
14 extern (C):
15
16 //
17 // Advisory Information (ADV)
18 //
19 /*
20 int posix_madvise(void*, size_t, int);
21 */
22
23 //
24 // Advisory Information and either Memory Mapped Files or Shared Memory Objects (MC1)
25 //
26 /*
27 POSIX_MADV_NORMAL
28 POSIX_MADV_SEQUENTIAL
29 POSIX_MADV_RANDOM
30 POSIX_MADV_WILLNEED
31 POSIX_MADV_DONTNEED
32 */
33
34 version( darwin )
35 {
36 const POSIX_MADV_NORMAL = 0;
37 const POSIX_MADV_RANDOM = 1;
38 const POSIX_MADV_SEQUENTIAL = 2;
39 const POSIX_MADV_WILLNEED = 3;
40 const POSIX_MADV_DONTNEED = 4;
41 }
42
43 //
44 // Memory Mapped Files, Shared Memory Objects, or Memory Protection (MC2)
45 //
46 /*
47 PROT_READ
48 PROT_WRITE
49 PROT_EXEC
50 PROT_NONE
51 */
52
53 version( linux )
54 {
55 const PROT_NONE = 0x0;
56 const PROT_READ = 0x1;
57 const PROT_WRITE = 0x2;
58 const PROT_EXEC = 0x4;
59 }
60 else version( darwin )
61 {
62 const PROT_NONE = 0x00;
63 const PROT_READ = 0x01;
64 const PROT_WRITE = 0x02;
65 const PROT_EXEC = 0x04;
66 }
67
68 //
69 // Memory Mapped Files, Shared Memory Objects, or Typed Memory Objects (MC3)
70 //
71 /*
72 void* mmap(void*, size_t, int, int, int, off_t);
73 int munmap(void*, size_t);
74 */
75
76 version( linux )
77 {
78 void* mmap(void*, size_t, int, int, int, off_t);
79 int munmap(void*, size_t);
80 }
81 else version( darwin )
82 {
83 void* mmap(void*, size_t, int, int, int, off_t);
84 int munmap(void*, size_t);
85 }
86
87 //
88 // Memory Mapped Files (MF)
89 //
90 /*
91 MAP_SHARED (MF|SHM)
92 MAP_PRIVATE (MF|SHM)
93 MAP_FIXED (MF|SHM)
94 MAP_FAILED (MF|SHM)
95
96 MS_ASYNC (MF|SIO)
97 MS_SYNC (MF|SIO)
98 MS_INVALIDATE (MF|SIO)
99
100 int msync(void*, size_t, int); (MF|SIO)
101 */
102
103 version( linux )
104 {
105 const MAP_SHARED = 0x01;
106 const MAP_PRIVATE = 0x02;
107 const MAP_FIXED = 0x10;
108 const MAP_ANON = 0x20; // non-standard
109
110 const MAP_FAILED = cast(void*) -1;
111
112 enum
113 {
114 MS_ASYNC = 1,
115 MS_SYNC = 4,
116 MS_INVALIDATE = 2
117 }
118
119 int msync(void*, size_t, int);
120 }
121 else version( darwin )
122 {
123 const MAP_SHARED = 0x0001;
124 const MAP_PRIVATE = 0x0002;
125 const MAP_FIXED = 0x0010;
126 const MAP_ANON = 0x1000; // non-standard
127
128 const MAP_FAILED = cast(void*)-1;
129
130 const MS_ASYNC = 0x0001;
131 const MS_INVALIDATE = 0x0002;
132 const MS_SYNC = 0x0010;
133
134 int msync(void*, size_t, int);
135 }
136
137 //
138 // Process Memory Locking (ML)
139 //
140 /*
141 MCL_CURRENT
142 MCL_FUTURE
143
144 int mlockall(int);
145 int munlockall();
146 */
147
148 version( linux )
149 {
150 const MCL_CURRENT = 1;
151 const MCL_FUTURE = 2;
152
153 int mlockall(int);
154 int munlockall();
155
156 }
157 else version( darwin )
158 {
159 const MCL_CURRENT = 0x0001;
160 const MCL_FUTURE = 0x0002;
161
162 int mlockall(int);
163 int munlockall();
164 }
165
166 //
167 // Range Memory Locking (MLR)
168 //
169 /*
170 int mlock(void*, size_t);
171 int munlock(void*, size_t);
172 */
173
174 version( linux )
175 {
176 int mlock(void*, size_t);
177 int munlock(void*, size_t);
178 }
179 else version( darwin )
180 {
181 int mlock(void*, size_t);
182 int munlock(void*, size_t);
183 }
184
185 //
186 // Memory Protection (MPR)
187 //
188 /*
189 int mprotect(void*, size_t, int);
190 */
191
192 version( darwin )
193 {
194 int mprotect(void*, size_t, int);
195 }
196
197 //
198 // Shared Memory Objects (SHM)
199 //
200 /*
201 int shm_open(char*, int, mode_t);
202 int shm_unlink(char*);
203 */
204
205 version( linux )
206 {
207 int shm_open(char*, int, mode_t);
208 int shm_unlink(char*);
209 }
210 else version( darwin )
211 {
212 int shm_open(char*, int, mode_t);
213 int shm_unlink(char*);
214 }
215
216 //
217 // Typed Memory Objects (TYM)
218 //
219 /*
220 POSIX_TYPED_MEM_ALLOCATE
221 POSIX_TYPED_MEM_ALLOCATE_CONTIG
222 POSIX_TYPED_MEM_MAP_ALLOCATABLE
223
224 struct posix_typed_mem_info
225 {
226 size_t posix_tmi_length;
227 }
228
229 int posix_mem_offset(void*, size_t, off_t *, size_t *, int *);
230 int posix_typed_mem_get_info(int, struct posix_typed_mem_info *);
231 int posix_typed_mem_open(char*, int, int);
232 */