IsoSpec  1.95
mman.h
1 /*
2  * sys/mman.h
3  * mman-win32
4  *
5  * This file has been included as a part of IsoSpec project, under a MIT licence. It
6  * comes from the repository:
7  *
8  * https://github.com/witwall/mman-win32
9  *
10  * which itself is a mirror of:
11  *
12  * https://code.google.com/archive/p/mman-win32/
13  */
14 
15 #pragma once
16 
17 #ifndef _WIN32_WINNT // Allow use of features specific to Windows XP or later.
18 #define _WIN32_WINNT 0x0501 // Change this to the appropriate value to target other versions of Windows.
19 #endif
20 
21 /* All the headers include this file. */
22 #ifndef _MSC_VER
23 #include <_mingw.h>
24 #endif
25 
26 /* Determine offset type */
27 #include <stdint.h>
28 #if defined(_WIN64)
29 typedef int64_t OffsetType;
30 #else
31 typedef uint32_t OffsetType;
32 #endif
33 
34 #include <sys/types.h>
35 
36 
37 #define PROT_NONE 0
38 #define PROT_READ 1
39 #define PROT_WRITE 2
40 #define PROT_EXEC 4
41 
42 #define MAP_FILE 0
43 #define MAP_SHARED 1
44 #define MAP_PRIVATE 2
45 #define MAP_TYPE 0xf
46 #define MAP_FIXED 0x10
47 #define MAP_ANONYMOUS 0x20
48 #define MAP_ANON MAP_ANONYMOUS
49 
50 #define MAP_FAILED ((void *)-1)
51 
52 /* Flags for msync. */
53 #define MS_ASYNC 1
54 #define MS_SYNC 2
55 #define MS_INVALIDATE 4
56 
57 void* mmap(void *addr, size_t len, int prot, int flags, int fildes, OffsetType off);
58 int munmap(void *addr, size_t len);
59 int _mprotect(void *addr, size_t len, int prot);
60 int msync(void *addr, size_t len, int flags);
61 int mlock(const void *addr, size_t len);
62 int munlock(const void *addr, size_t len);
63 
64