| 1 | #ifndef _MMAP_ACCESS_MODE |
| 2 | #define _MMAP_ACCESS_MODE |
| 3 | |
| 4 | #include <stdio.h> |
| 5 | |
| 6 | #define ALIGN_TO_PAGE(x) ((x) & ~(getpagesize() - 1)) |
| 7 | #define UPPER_ALIGN_TO_PAGE(x) ALIGN_TO_PAGE((x)+(getpagesize()-1)) |
| 8 | #define OFFSET_INTO_PAGE(x) ((x) & (getpagesize() - 1)) |
| 9 | |
| 10 | namespace mmap_allocator_namespace |
| 11 | { |
| 12 | enum access_mode { |
| 13 | DEFAULT_STL_ALLOCATOR, /* Default STL allocator (malloc based). Reason is to have containers that do both and are compatible */ |
| 14 | READ_ONLY, /* Readonly modus. Segfaults when vector content is written to */ |
| 15 | READ_WRITE_PRIVATE, /* Read/write access, writes are not propagated to disk */ |
| 16 | READ_WRITE_SHARED /* Read/write access, writes are propagated to disk (file is modified) */ |
| 17 | }; |
| 18 | |
| 19 | enum allocator_flags { |
| 20 | MAP_WHOLE_FILE = 1, |
| 21 | ALLOW_REMAP = 2, |
| 22 | BYPASS_FILE_POOL = 4, |
| 23 | KEEP_FOREVER = 8 |
| 24 | }; |
| 25 | |
| 26 | void set_verbosity(int v); |
| 27 | int get_verbosity(void); |
| 28 | } |
| 29 | |
| 30 | #endif |