]> git.proxmox.com Git - rustc.git/blob - src/compiler-rt/lib/profile/WindowsMMap.h
New upstream version 1.19.0+dfsg3
[rustc.git] / src / compiler-rt / lib / profile / WindowsMMap.h
1 /*===- WindowsMMap.h - Support library for PGO instrumentation ------------===*\
2 |*
3 |* The LLVM Compiler Infrastructure
4 |*
5 |* This file is distributed under the University of Illinois Open Source
6 |* License. See LICENSE.TXT for details.
7 |*
8 \*===----------------------------------------------------------------------===*/
9
10 #ifndef PROFILE_INSTRPROFILING_WINDOWS_MMAP_H
11 #define PROFILE_INSTRPROFILING_WINDOWS_MMAP_H
12
13 #if defined(_WIN32)
14
15 #include <BaseTsd.h>
16 #include <io.h>
17 #include <sys/types.h>
18
19 /*
20 * mmap() flags
21 */
22 #define PROT_READ 0x1
23 #define PROT_WRITE 0x2
24 #define PROT_EXEC 0x0
25
26 #define MAP_FILE 0x00
27 #define MAP_SHARED 0x01
28 #define MAP_PRIVATE 0x02
29 #define MAP_ANONYMOUS 0x20
30 #define MAP_ANON MAP_ANONYMOUS
31 #define MAP_FAILED ((void *) -1)
32
33 /*
34 * msync() flags
35 */
36 #define MS_ASYNC 0x0001 /* return immediately */
37 #define MS_INVALIDATE 0x0002 /* invalidate all cached data */
38 #define MS_SYNC 0x0010 /* msync synchronously */
39
40 /*
41 * flock() operations
42 */
43 #define LOCK_SH 1 /* shared lock */
44 #define LOCK_EX 2 /* exclusive lock */
45 #define LOCK_NB 4 /* don't block when locking */
46 #define LOCK_UN 8 /* unlock */
47
48 void *mmap(void *start, size_t length, int prot, int flags, int fd,
49 off_t offset);
50
51 void munmap(void *addr, size_t length);
52
53 int msync(void *addr, size_t length, int flags);
54
55 int flock(int fd, int operation);
56
57 #endif /* _WIN32 */
58
59 #endif /* PROFILE_INSTRPROFILING_WINDOWS_MMAP_H */