• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 /*
2  * Copyright 2013, The Android Open Source Project
3  *
4  * Licensed under the Apache License, Version 2.0 (the "License");
5  * you may not use this file except in compliance with the License.
6  * You may obtain a copy of the License at
7  *
8  *     http://www.apache.org/licenses/LICENSE-2.0
9  *
10  * Unless required by applicable law or agreed to in writing, software
11  * distributed under the License is distributed on an "AS IS" BASIS,
12  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13  * See the License for the specific language governing permissions and
14  * limitations under the License.
15  */
16 
17 #ifndef MMANWINDOWS_H
18 #define MMANWINDOWS_H
19 
20 #ifdef _WIN32
21 
22 #include <stdlib.h>
23 #include <sys/types.h>
24 
25 // From bionic/libc/include/sys/mman.h
26 #ifndef MAP_ANON
27 #define MAP_ANON  MAP_ANONYMOUS
28 #endif
29 
30 #define MAP_FAILED ((void *)-1)
31 
32 #define MREMAP_MAYMOVE  1
33 #define MREMAP_FIXED    2
34 
35 extern void*  mmap(void *, size_t, int, int, int, off_t);
36 extern int    munmap(void *, size_t);
37 extern int    msync(const void *, size_t, int);
38 extern int    mprotect(const void *, size_t, int);
39 extern void*  mremap(void *, size_t, size_t, unsigned long);
40 
41 extern int    mlockall(int);
42 extern int    munlockall(void);
43 extern int    mlock(const void *, size_t);
44 extern int    munlock(const void *, size_t);
45 extern int    madvise(const void *, size_t, int);
46 
47 extern int    mlock(const void *addr, size_t len);
48 extern int    munlock(const void *addr, size_t len);
49 
50 extern int    mincore(void*  start, size_t  length, unsigned char*  vec);
51 
52 // From bionic/libc/kernel/common/asm-generic/mman-common.h
53 #define PROT_READ 0x1
54 #define PROT_WRITE 0x2
55 #define PROT_EXEC 0x4
56 #define PROT_SEM 0x8
57 #define PROT_NONE 0x0
58 
59 #define MAP_PRIVATE 0x02
60 #define MAP_ANONYMOUS 0x20
61 
62 #endif  // _WIN32
63 
64 #endif  // MMANWINDOWS_H
65