1 /**
2  * D header file for NetBSD
3  *
4  * Authors: Martin Nowak
5  *
6  * http://cvsweb.netbsd.org/bsdweb.cgi/~checkout~/src/sys/sys/mman.h
7  */
8 module core.sys.netbsd.sys.mman;
9 
10 version (NetBSD):
11 extern (C):
12 nothrow:
13 
14 public import core.sys.posix.sys.mman;
15 import core.sys.posix.sys.types;
16 
17 enum __BSD_VISIBLE = true;
18 
19 static if (__BSD_VISIBLE)
20 {
21     enum INHERIT_SHARE = 0;
22     enum INHERIT_COPY = 1;
23     enum INHERIT_NONE = 2;
24     enum INHERIT_DONATE_COPY = 3;
25     enum INHERIT_ZERO = 4;
26 }
27 
28 // already in core.sys.posix.sys.mman
29 // enum PROT_NONE = 0x00;
30 // enum PROT_READ = 0x01;
31 // enum PROT_WRITE = 0x02;
32 // enum PROT_EXEC = 0x04;
33 // enum MAP_SHARED = 0x0001;
34 // enum MAP_PRIVATE = 0x0002;
35 static if (__BSD_VISIBLE)
36     enum MAP_COPY = 0x0002;
37 // enum MAP_FIXED = 0x0010;
38 
39 static if (__BSD_VISIBLE)
40 {
41     enum MAP_RENAME = 0x0020;
42     enum MAP_NORESERVE = 0x0040;
43     enum MAP_HASSEMAPHORE = 0x0200;
44     enum MAP_STACK = 0x2000;
45     enum MAP_WIRED = 0x0800;
46 
47     enum MAP_FILE = 0x0000;
48 
49     // already in core.sys.posix.sys.mman
50     // enum MAP_ANON = 0x1000;
51     //#ifndef _KERNEL
52     alias MAP_ANONYMOUS = MAP_ANON;
53     //#endif /* !_KERNEL */
54 
55 
56     extern(D) int MAP_ALIGNED(int n) { return n << MAP_ALIGNMENT_SHIFT; }
57     enum MAP_ALIGNMENT_SHIFT = 24;
58     enum MAP_ALIGNMENT_MASK = MAP_ALIGNED(0xff);
59 }
60 
61 //static if (__POSIX_VISIBLE >= 199309)
62 //{
63     // already in core.sys.posix.sys.mman
64     // enum MCL_CURRENT = 0x0001;
65     // enum MCL_FUTURE = 0x0002;
66 //}
67 
68 // already in core.sys.posix.sys.mman
69 enum MAP_FAILED = cast(void*)-1;
70 
71 // already in core.sys.posix.sys.mman
72 // enum MS_SYNC = 0x0000;
73 // enum MS_ASYNC = 0x0001;
74 // enum MS_INVALIDATE = 0x0002;
75 
76 enum _MADV_NORMAL = 0;
77 enum _MADV_RANDOM = 1;
78 enum _MADV_SEQUENTIAL = 2;
79 enum _MADV_WILLNEED = 3;
80 enum _MADV_DONTNEED = 4;
81 
82 static if (__BSD_VISIBLE)
83 {
84     alias MADV_NORMAL = _MADV_NORMAL;
85     alias MADV_RANDOM = _MADV_RANDOM;
86     alias MADV_SEQUENTIAL = _MADV_SEQUENTIAL;
87     alias MADV_WILLNEED = _MADV_WILLNEED;
88     alias MADV_DONTNEED = _MADV_DONTNEED;
89     enum MADV_SPACEAVAIL = 5;
90     enum MADV_FREE = 6;
91 }
92 
93 //static if (__POSIX_VISIBLE >= 200112)
94 //{
95     // already in core.sys.posix.sys.mman
96     // alias POSIX_MADV_NORMAL = _MADV_NORMAL;
97     // alias POSIX_MADV_RANDOM = _MADV_RANDOM;
98     // alias POSIX_MADV_SEQUENTIAL = _MADV_SEQUENTIAL;
99     // alias POSIX_MADV_WILLNEED = _MADV_WILLNEED;
100     // alias POSIX_MADV_DONTNEED = _MADV_DONTNEED;
101 //}
102 
103 static if (__BSD_VISIBLE)
104 {
105     //int getpagesizes(size_t *, int);
106     int madvise(void *, size_t, int);
107     int mincore(const(void) *, size_t, char *);
108     int minherit(void *, size_t, int);
109 }
110 // already in core.sys.posix.sys.mman
111 // int mlock(const void *, size_t);
112 // void *  mmap(void *, size_t, int, int, int, off_t);
113 // int mprotect(const void *, size_t, int);
114 // int msync(void *, size_t, int);
115 // int munlock(const void *, size_t);
116 // int munmap(void *, size_t);
117 //static if (__POSIX_VISIBLE >= 200112)
118     // int posix_madvise(void *, size_t, int);
119 //static if (__POSIX_VISIBLE >= 199309)
120 //{
121     // int mlockall(int);
122     // int munlockall();
123     // int shm_open(const(char) *, int, mode_t);
124     // int shm_unlink(const(char) *);
125 //}