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 #if defined(MMAN_LIBRARY)
27 #define MMANSHARED_EXPORT __declspec(dllexport)
28 #else
29 #define MMANSHARED_EXPORT __declspec(dllimport)
30 #endif
31 
32 /* Determine offset type */
33 #include <stdint.h>
34 #if defined(_WIN64)
35 typedef int64_t OffsetType;
36 #else
37 typedef uint32_t OffsetType;
38 #endif
39 
40 #include <sys/types.h>
41 
42 #ifdef __cplusplus
43 extern "C" {
44 #endif
45 
46 #define PROT_NONE 0
47 #define PROT_READ 1
48 #define PROT_WRITE 2
49 #define PROT_EXEC 4
50 
51 #define MAP_FILE 0
52 #define MAP_SHARED 1
53 #define MAP_PRIVATE 2
54 #define MAP_TYPE 0xf
55 #define MAP_FIXED 0x10
56 #define MAP_ANONYMOUS 0x20
57 #define MAP_ANON MAP_ANONYMOUS
58 
59 #define MAP_FAILED ((void *)-1)
60 
61 /* Flags for msync. */
62 #define MS_ASYNC 1
63 #define MS_SYNC 2
64 #define MS_INVALIDATE 4
65 
66 MMANSHARED_EXPORT void* mmap(void *addr, size_t len, int prot, int flags, int fildes, OffsetType off);
67 MMANSHARED_EXPORT int munmap(void *addr, size_t len);
68 MMANSHARED_EXPORT int _mprotect(void *addr, size_t len, int prot);
69 MMANSHARED_EXPORT int msync(void *addr, size_t len, int flags);
70 MMANSHARED_EXPORT int mlock(const void *addr, size_t len);
71 MMANSHARED_EXPORT int munlock(const void *addr, size_t len);
72 
73 #ifdef __cplusplus
74 }
75 #endif
76