1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
use super::super::c;
use bitflags::bitflags;
bitflags! {
pub struct ProtFlags: u32 {
const READ = linux_raw_sys::general::PROT_READ;
const WRITE = linux_raw_sys::general::PROT_WRITE;
const EXEC = linux_raw_sys::general::PROT_EXEC;
}
}
bitflags! {
pub struct MprotectFlags: u32 {
const READ = linux_raw_sys::general::PROT_READ;
const WRITE = linux_raw_sys::general::PROT_WRITE;
const EXEC = linux_raw_sys::general::PROT_EXEC;
const GROWSUP = linux_raw_sys::general::PROT_GROWSUP;
const GROWSDOWN = linux_raw_sys::general::PROT_GROWSDOWN;
}
}
bitflags! {
pub struct MapFlags: u32 {
const SHARED = linux_raw_sys::general::MAP_SHARED;
const SHARED_VALIDATE = linux_raw_sys::general::MAP_SHARED_VALIDATE;
const PRIVATE = linux_raw_sys::general::MAP_PRIVATE;
const DENYWRITE = linux_raw_sys::general::MAP_DENYWRITE;
const FIXED = linux_raw_sys::general::MAP_FIXED;
const FIXED_NOREPLACE = linux_raw_sys::general::MAP_FIXED_NOREPLACE;
const GROWSDOWN = linux_raw_sys::general::MAP_GROWSDOWN;
const HUGETLB = linux_raw_sys::general::MAP_HUGETLB;
const HUGE_2MB = linux_raw_sys::general::MAP_HUGE_2MB;
const HUGE_1GB = linux_raw_sys::general::MAP_HUGE_1GB;
const LOCKED = linux_raw_sys::general::MAP_LOCKED;
const NORESERVE = linux_raw_sys::general::MAP_NORESERVE;
const POPULATE = linux_raw_sys::general::MAP_POPULATE;
const STACK = linux_raw_sys::general::MAP_STACK;
#[cfg(not(any(target_arch = "mips", target_arch = "mips64")))]
const SYNC = linux_raw_sys::general::MAP_SYNC;
#[cfg(not(any(target_arch = "mips", target_arch = "mips64")))]
const UNINITIALIZED = linux_raw_sys::general::MAP_UNINITIALIZED;
}
}
bitflags! {
pub struct MremapFlags: u32 {
const MAYMOVE = linux_raw_sys::general::MREMAP_MAYMOVE;
const DONTUNMAP = linux_raw_sys::general::MREMAP_DONTUNMAP;
}
}
bitflags! {
pub struct MlockFlags: u32 {
const ONFAULT = linux_raw_sys::general::MLOCK_ONFAULT;
}
}
bitflags! {
pub struct MsyncFlags: u32 {
const SYNC = linux_raw_sys::general::MS_SYNC;
const ASYNC = linux_raw_sys::general::MS_ASYNC;
const INVALIDATE = linux_raw_sys::general::MS_INVALIDATE;
}
}
bitflags! {
pub struct UserfaultfdFlags: c::c_uint {
const CLOEXEC = linux_raw_sys::general::O_CLOEXEC;
const NONBLOCK = linux_raw_sys::general::O_NONBLOCK;
}
}
#[derive(Debug, Copy, Clone, Eq, PartialEq)]
#[repr(u32)]
#[non_exhaustive]
pub enum Advice {
Normal = linux_raw_sys::general::MADV_NORMAL,
Sequential = linux_raw_sys::general::MADV_SEQUENTIAL,
Random = linux_raw_sys::general::MADV_RANDOM,
WillNeed = linux_raw_sys::general::MADV_WILLNEED,
LinuxDontNeed = linux_raw_sys::general::MADV_DONTNEED,
LinuxFree = linux_raw_sys::general::MADV_FREE,
LinuxRemove = linux_raw_sys::general::MADV_REMOVE,
LinuxDontFork = linux_raw_sys::general::MADV_DONTFORK,
LinuxDoFork = linux_raw_sys::general::MADV_DOFORK,
LinuxHwPoison = linux_raw_sys::general::MADV_HWPOISON,
#[cfg(not(any(target_arch = "mips", target_arch = "mips64")))]
LinuxSoftOffline = linux_raw_sys::general::MADV_SOFT_OFFLINE,
LinuxMergeable = linux_raw_sys::general::MADV_MERGEABLE,
LinuxUnmergeable = linux_raw_sys::general::MADV_UNMERGEABLE,
LinuxHugepage = linux_raw_sys::general::MADV_HUGEPAGE,
LinuxNoHugepage = linux_raw_sys::general::MADV_NOHUGEPAGE,
LinuxDontDump = linux_raw_sys::general::MADV_DONTDUMP,
LinuxDoDump = linux_raw_sys::general::MADV_DODUMP,
LinuxWipeOnFork = linux_raw_sys::general::MADV_WIPEONFORK,
LinuxKeepOnFork = linux_raw_sys::general::MADV_KEEPONFORK,
LinuxCold = linux_raw_sys::general::MADV_COLD,
LinuxPageOut = linux_raw_sys::general::MADV_PAGEOUT,
LinuxPopulateRead = linux_raw_sys::general::MADV_POPULATE_READ,
LinuxPopulateWrite = linux_raw_sys::general::MADV_POPULATE_WRITE,
}
impl Advice {
#[allow(non_upper_case_globals)]
pub const DontNeed: Self = Self::Normal;
}