The OpenD Programming Language

1 /**
2  * D header file for Darwin
3  *
4  * Authors: Martin Nowak
5  */
6 module core.sys.darwin.sys.mman;
7 
8 version (OSX)
9     version = Darwin;
10 else version (iOS)
11     version = Darwin;
12 else version (TVOS)
13     version = Darwin;
14 else version (WatchOS)
15     version = Darwin;
16 
17 version (Darwin):
18 extern (C):
19 nothrow:
20 @nogc:
21 
22 public import core.sys.posix.sys.mman;
23 import core.sys.darwin.sys.cdefs;
24 import core.sys.posix.sys.types;
25 
26 // already in core.sys.posix.sys.mman
27 // enum PROT_NONE = 0x00;
28 // enum PROT_READ = 0x01;
29 // enum PROT_WRITE = 0x02;
30 // enum PROT_EXEC = 0x04;
31 
32 // already in core.sys.posix.sys.mman
33 // enum MAP_SHARED = 0x0001;
34 // enum MAP_PRIVATE = 0x0002;
35 static if (_DARWIN_C_SOURCE)
36     alias MAP_COPY = MAP_PRIVATE;
37 // enum MAP_FIXED = 0x0010;
38 
39 static if (_DARWIN_C_SOURCE)
40 {
41      enum MAP_RENAME = 0x0020;
42      enum MAP_NORESERVE = 0x0040;
43      enum MAP_RESERVED0080 = 0x0080;
44      enum MAP_NOEXTEND = 0x0100;
45      enum MAP_HASSEMAPHORE = 0x0200;
46      enum MAP_NOCACHE = 0x0400;
47      enum MAP_JIT = 0x0800;
48 }
49 
50 // already in core.sys.posix.sys.mman
51 // enum MCL_CURRENT = 0x0001;
52 // enum MCL_FUTURE = 0x0002;
53 
54 // enum MAP_FAILED = cast(void*)-1;
55 
56 // enum MS_ASYNC = 0x0001;
57 // enum MS_INVALIDATE = 0x0002;
58 // enum MS_SYNC = 0x0010;
59 
60 static if (_DARWIN_C_SOURCE)
61 {
62     enum MS_KILLPAGES = 0x0004;
63     enum MS_DEACTIVATE = 0x0008;
64 
65     enum MAP_FILE = 0x0000;
66 
67 // already in core.sys.posix.sys.mman
68 // enum MAP_ANON = 0x1000;
69 
70 // enum POSIX_MADV_NORMAL = 0;
71 // enum POSIX_MADV_RANDOM = 1;
72 // enum POSIX_MADV_SEQUENTIAL = 2;
73 // enum POSIX_MADV_WILLNEED = 3;
74 // enum POSIX_MADV_DONTNEED = 4;
75 
76     alias MADV_NORMAL = POSIX_MADV_NORMAL;
77     alias MADV_RANDOM = POSIX_MADV_RANDOM;
78     alias MADV_SEQUENTIAL = POSIX_MADV_SEQUENTIAL;
79     alias MADV_WILLNEED = POSIX_MADV_WILLNEED;
80     alias MADV_DONTNEED = POSIX_MADV_DONTNEED;
81     enum MADV_FREE = 5;
82     enum MADV_ZERO_WIRED_PAGES = 6;
83     enum MADV_FREE_REUSABLE = 7;
84     enum MADV_FREE_REUSE = 8;
85     enum MADV_CAN_REUSE = 9;
86 
87     enum MINCORE_INCORE = 0x1;
88     enum MINCORE_REFERENCED = 0x2;
89     enum MINCORE_MODIFIED = 0x4;
90     enum MINCORE_REFERENCED_OTHER = 0x8;
91     enum MINCORE_MODIFIED_OTHER = 0x10;
92 }
93 
94 // already in core.sys.posix.sys.mman
95 // int mlockall(int);
96 // int munlockall(void);
97 // int mlock(const void *, size_t);
98 // void *  mmap(void *, size_t, int, int, int, off_t);
99 // int mprotect(void *, size_t, int);
100 // int msync(void *, size_t, int);
101 // int munlock(const void *, size_t);
102 // int munmap(void *, size_t);
103 // int shm_open(const char *, int, ...);
104 // int shm_unlink(const char *);
105 // int posix_madvise(void *, size_t, int);
106 
107 static if (_DARWIN_C_SOURCE)
108 {
109     int madvise(void *, size_t, int);
110     int mincore(const(void)*, size_t, char *);
111     int minherit(void *, size_t, int);
112 }