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