• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 // SPDX-License-Identifier: GPL-2.0-or-later
2 /*
3  * Copyright (c) 2015 Fujitsu Ltd.
4  * Author: Guangwen Feng <fenggw-fnst@cn.fujitsu.com>
5  */
6 
7 #ifndef LAPI_MMAP_H__
8 #define LAPI_MMAP_H__
9 
10 #include "config.h"
11 #include <sys/mman.h>
12 
13 #ifndef MAP_SHARED_VALIDATE
14 # define MAP_SHARED_VALIDATE 0x03
15 #endif
16 
17 #ifndef MAP_HUGETLB
18 # define MAP_HUGETLB 0x40000
19 #endif
20 
21 #ifndef MADV_REMOVE
22 # define MADV_REMOVE 9
23 #endif
24 
25 #ifndef MADV_DONTFORK
26 # define MADV_DONTFORK 10
27 #endif
28 
29 #ifndef MADV_DOFORK
30 # define MADV_DOFORK   11
31 #endif
32 
33 #ifndef MADV_HWPOISON
34 # define MADV_HWPOISON 100
35 #endif
36 
37 #ifndef MADV_SOFT_OFFLINE
38 # define MADV_SOFT_OFFLINE 101
39 #endif
40 
41 #ifndef MADV_MERGEABLE
42 # define MADV_MERGEABLE   12
43 #endif
44 
45 #ifndef MADV_UNMERGEABLE
46 # define MADV_UNMERGEABLE 13
47 #endif
48 
49 #ifndef MADV_HUGEPAGE
50 # define MADV_HUGEPAGE   14
51 #endif
52 
53 #ifndef MADV_NOHUGEPAGE
54 # define MADV_NOHUGEPAGE 15
55 #endif
56 
57 #ifndef MADV_DONTDUMP
58 # define MADV_DONTDUMP 16
59 #endif
60 
61 #ifndef MADV_DODUMP
62 # define MADV_DODUMP   17
63 #endif
64 
65 #ifndef MADV_FREE
66 # define MADV_FREE	8
67 #endif
68 
69 #ifndef MADV_WIPEONFORK
70 # define MADV_WIPEONFORK 18
71 # define MADV_KEEPONFORK 19
72 #endif
73 
74 #ifndef MADV_COLD
75 # define MADV_COLD	20
76 #endif
77 
78 #ifndef MADV_PAGEOUT
79 # define MADV_PAGEOUT	21
80 #endif
81 
82 #ifndef MAP_FIXED_NOREPLACE
83 
84 #ifdef __alpha__
85 # define MAP_FIXED_NOREPLACE 0x200000
86 #else
87 # define MAP_FIXED_NOREPLACE 0x100000
88 #endif
89 
90 #endif /* MAP_FIXED_NOREPLACE */
91 
92 #ifdef HAVE_SYS_SHM_H
93 # include <sys/shm.h>
94 # define MMAP_GRANULARITY SHMLBA
95 #else
96 # include <unistd.h>
97 # define MMAP_GRANULARITY getpagesize()
98 #endif /* HAVE_SYS_SHM_H */
99 
100 #endif /* LAPI_MMAP_H__ */
101