2016-01-06 01:27:01 +08:00
|
|
|
/*===- WindowsMMap.h - Support library for PGO instrumentation ------------===*\
|
|
|
|
|*
|
2019-01-19 16:50:56 +08:00
|
|
|
|* Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
|
|
|
|
|* See https://llvm.org/LICENSE.txt for license information.
|
|
|
|
|* SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
|
2016-01-06 01:27:01 +08:00
|
|
|
|*
|
|
|
|
\*===----------------------------------------------------------------------===*/
|
|
|
|
|
|
|
|
#ifndef PROFILE_INSTRPROFILING_WINDOWS_MMAP_H
|
|
|
|
#define PROFILE_INSTRPROFILING_WINDOWS_MMAP_H
|
|
|
|
|
|
|
|
#if defined(_WIN32)
|
|
|
|
|
2018-09-11 04:28:06 +08:00
|
|
|
#include <basetsd.h>
|
2016-01-06 01:27:01 +08:00
|
|
|
#include <io.h>
|
|
|
|
#include <sys/types.h>
|
|
|
|
|
|
|
|
/*
|
|
|
|
* mmap() flags
|
|
|
|
*/
|
|
|
|
#define PROT_READ 0x1
|
|
|
|
#define PROT_WRITE 0x2
|
2016-06-18 02:12:50 +08:00
|
|
|
#define PROT_EXEC 0x0
|
2016-01-06 01:27:01 +08:00
|
|
|
|
|
|
|
#define MAP_FILE 0x00
|
|
|
|
#define MAP_SHARED 0x01
|
|
|
|
#define MAP_PRIVATE 0x02
|
|
|
|
#define MAP_ANONYMOUS 0x20
|
|
|
|
#define MAP_ANON MAP_ANONYMOUS
|
|
|
|
#define MAP_FAILED ((void *) -1)
|
|
|
|
|
|
|
|
/*
|
|
|
|
* msync() flags
|
|
|
|
*/
|
|
|
|
#define MS_ASYNC 0x0001 /* return immediately */
|
|
|
|
#define MS_INVALIDATE 0x0002 /* invalidate all cached data */
|
|
|
|
#define MS_SYNC 0x0010 /* msync synchronously */
|
|
|
|
|
|
|
|
/*
|
|
|
|
* flock() operations
|
|
|
|
*/
|
|
|
|
#define LOCK_SH 1 /* shared lock */
|
|
|
|
#define LOCK_EX 2 /* exclusive lock */
|
|
|
|
#define LOCK_NB 4 /* don't block when locking */
|
|
|
|
#define LOCK_UN 8 /* unlock */
|
|
|
|
|
2018-11-07 17:38:26 +08:00
|
|
|
#ifdef __USE_FILE_OFFSET64
|
|
|
|
# define DWORD_HI(x) (x >> 32)
|
|
|
|
# define DWORD_LO(x) ((x) & 0xffffffff)
|
|
|
|
#else
|
|
|
|
# define DWORD_HI(x) (0)
|
|
|
|
# define DWORD_LO(x) (x)
|
|
|
|
#endif
|
|
|
|
|
2016-01-06 01:27:01 +08:00
|
|
|
void *mmap(void *start, size_t length, int prot, int flags, int fd,
|
|
|
|
off_t offset);
|
|
|
|
|
|
|
|
void munmap(void *addr, size_t length);
|
|
|
|
|
|
|
|
int msync(void *addr, size_t length, int flags);
|
|
|
|
|
|
|
|
int flock(int fd, int operation);
|
|
|
|
|
|
|
|
#endif /* _WIN32 */
|
|
|
|
|
|
|
|
#endif /* PROFILE_INSTRPROFILING_WINDOWS_MMAP_H */
|