1 /*===- WindowsMMap.h - Support library for PGO instrumentation ------------===*\
3 |* Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
4 |* See https://llvm.org/LICENSE.txt for license information.
5 |* SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
7 \*===----------------------------------------------------------------------===*/
9 #ifndef PROFILE_INSTRPROFILING_WINDOWS_MMAP_H
10 #define PROFILE_INSTRPROFILING_WINDOWS_MMAP_H
16 #include <sys/types.h>
22 #define PROT_WRITE 0x2
26 #define MAP_SHARED 0x01
27 #define MAP_PRIVATE 0x02
28 #define MAP_ANONYMOUS 0x20
29 #define MAP_ANON MAP_ANONYMOUS
30 #define MAP_FAILED ((void *) -1)
35 #define MS_ASYNC 0x0001 /* return immediately */
36 #define MS_INVALIDATE 0x0002 /* invalidate all cached data */
37 #define MS_SYNC 0x0010 /* msync synchronously */
43 #define MADV_NORMAL 0 /* no special treatment */
44 #define MADV_WILLNEED 3 /* expect access in the near future */
45 #define MADV_DONTNEED 4 /* do not expect access in the near future */
50 #define LOCK_SH 1 /* shared lock */
51 #define LOCK_EX 2 /* exclusive lock */
52 #define LOCK_NB 4 /* don't block when locking */
53 #define LOCK_UN 8 /* unlock */
55 #ifdef __USE_FILE_OFFSET64
56 # define DWORD_HI(x) (x >> 32)
57 # define DWORD_LO(x) ((x) & 0xffffffff)
59 # define DWORD_HI(x) (0)
60 # define DWORD_LO(x) (x)
63 #define mmap __llvm_profile_mmap
64 #define munmap __llvm_profile_munmap
65 #define msync __llvm_profile_msync
66 #define madvise __llvm_profile_madvise
67 #define flock __llvm_profile_flock
69 void *mmap(void *start
, size_t length
, int prot
, int flags
, int fd
,
72 void munmap(void *addr
, size_t length
);
74 int msync(void *addr
, size_t length
, int flags
);
76 int madvise(void *addr
, size_t length
, int advice
);
78 int flock(int fd
, int operation
);
82 #endif /* PROFILE_INSTRPROFILING_WINDOWS_MMAP_H */