1 /**
2  * D header file for DragonFlyBSD
3  *
4  * Authors:   Martin Nowak,Diederik de Groot(port:DragonFlyBSD)
5  * Copied:  From core/sys/freebsd/sys
6  */
7 module core.sys.dragonflybsd.sys.mman;
8 
9 version (DragonFlyBSD):
10 extern (C) nothrow @nogc @system:
11 
12 public import core.sys.posix.sys.mman;
13 import core.sys.dragonflybsd.sys.cdefs;
14 import core.sys.posix.sys.types;
15 
16 enum INHERIT_SHARE        = 0;
17 enum INHERIT_COPY         = 1;
18 enum INHERIT_NONE         = 2;
19 
20 // already in core.sys.posix.sys.mman
21 // enum PROT_NONE             = 0x00;
22 // enum PROT_READ             = 0x01;
23 // enum PROT_WRITE            = 0x02;
24 // enum PROT_EXEC             = 0x04;
25 // enum MAP_SHARED            = 0x0001;
26 // enum MAP_PRIVATE           = 0x0002;
27 alias MAP_COPY            = MAP_PRIVATE;
28 
29 enum MAP_FIXED                = 0x00010;
30 enum MAP_RENAME           = 0x00020;
31 enum MAP_NORESERVE        = 0x00040;
32 enum MAP_INHERIT          = 0x00080;
33 enum MAP_NOEXTEND         = 0x00100;
34 enum MAP_HASSEMAPHORE     = 0x00200;
35 enum MAP_STACK            = 0x00400;
36 enum MAP_NOSYNC           = 0x00800;
37 
38 enum MAP_FILE             = 0x00000;
39 //enum MAP_ANON           = 0x01000;        // already in core.sys.posix.sys.mman
40 alias MAP_ANONYMOUS       = MAP_ANON;
41 enum MAP_VPAGETABLE       = 0x02000;
42 
43 enum MAP_TRYFIXED         = 0x10000;
44 enum MAP_NOCORE           = 0x20000;
45 enum MAP_SIZEALIGN        = 0x40000;
46 
47 //enum MAP_EXCL           = 0x00004000;
48 //enum MAP_NOCORE         = 0x00020000;
49 //enum MAP_PREFAULT_READ  = 0x00040000;
50 //version (LP64)
51 //    enum MAP_32BIT      = 0x00080000;
52 
53 //extern(D) int MAP_ALIGNED(int n) { return n << MAP_ALIGNMENT_SHIFT; }
54 //enum MAP_ALIGNMENT_SHIFT = 24;
55 //enum MAP_ALIGNMENT_MASK = MAP_ALIGNED(0xff);
56 //enum MAP_ALIGNED_SUPER = MAP_ALIGNED(1);
57 
58 // enum MCL_CURRENT       = 0x0001;           // already in core.sys.posix.sys.mman
59 // enum MCL_FUTURE        = 0x0002;            // already in core.sys.posix.sys.mman
60 
61 // already in core.sys.posix.sys.mman
62 enum MAP_FAILED = cast(void*)-1;
63 // enum MS_SYNC               = 0x0000;         // already in core.sys.posix.sys.mman
64 // enum MS_ASYNC              = 0x0001;         // already in core.sys.posix.sys.mman
65 // enum MS_INVALIDATE         = 0x0002;         // already in core.sys.posix.sys.mman
66 
67 enum _MADV_NORMAL             = 0;
68 enum _MADV_RANDOM             = 1;
69 enum _MADV_SEQUENTIAL         = 2;
70 enum _MADV_WILLNEED           = 3;
71 enum _MADV_DONTNEED           = 4;
72 
73 alias MADV_NORMAL         = _MADV_NORMAL;
74 alias MADV_RANDOM         = _MADV_RANDOM;
75 alias MADV_SEQUENTIAL     = _MADV_SEQUENTIAL;
76 alias MADV_WILLNEED       = _MADV_WILLNEED;
77 alias MADV_DONTNEED       = _MADV_DONTNEED;
78 enum MADV_FREE            = 5;
79 enum MADV_NOSYNC          = 6;
80 enum MADV_AUTOSYNC        = 7;
81 enum MADV_NOCORE          = 8;
82 enum MADV_CORE            = 9;
83 enum MADV_INVAL           = 10;
84 enum MADV_SETMAP          = 11;
85 
86 alias MADV_CONTROL_START  = MADV_INVAL;
87 alias MADV_CONTROL_END    = MADV_SETMAP;
88 
89 enum MINCORE_INCORE       = 0x1;
90 enum MINCORE_REFERENCED   = 0x2;
91 enum MINCORE_MODIFIED     = 0x4;
92 enum MINCORE_REFERENCED_OTHER = 0x8;
93 enum MINCORE_MODIFIED_OTHER   = 0x10;
94 enum MINCORE_SUPER        = 0x20;
95 
96 enum SHM_ANON             = cast(const(char) *)1;
97 
98 // already in core.sys.posix.sys.mman
99 // alias POSIX_MADV_NORMAL    = _MADV_NORMAL;
100 // alias POSIX_MADV_RANDOM    = _MADV_RANDOM;
101 // alias POSIX_MADV_SEQUENTIAL= _MADV_SEQUENTIAL;
102 // alias POSIX_MADV_WILLNEED  = _MADV_WILLNEED;
103 // alias POSIX_MADV_DONTNEED  = _MADV_DONTNEED;
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 // int posix_madvise(void *, size_t, int);
118 
119 // int mlockall(int);
120 // int munlockall();
121 // int shm_open(const(char) *, int, mode_t);
122 // int shm_unlink(const(char) *);
123 
124 // int madvise(void *, size_t, int);
125 // int mcontrol(void *, size_t, int, off_t);
126 // int mincore(const void *, size_t, char *);
127 // int minherit(void *, size_t, int);