Fix build warnings (errors on CI) due to mmap flag rename and deprecation.

This commit is contained in:
Chris Fallin
2020-06-03 09:35:09 -07:00
parent a76639c6fb
commit b8e31d7c8e
3 changed files with 7 additions and 7 deletions

View File

@@ -111,7 +111,7 @@ impl Drop for PtrLen {
fn drop(&mut self) { fn drop(&mut self) {
if !self.ptr.is_null() { if !self.ptr.is_null() {
unsafe { unsafe {
region::protect(self.ptr, self.len, region::Protection::ReadWrite) region::protect(self.ptr, self.len, region::Protection::READ_WRITE)
.expect("unable to unprotect memory"); .expect("unable to unprotect memory");
libc::free(self.ptr as _); libc::free(self.ptr as _);
} }
@@ -179,7 +179,7 @@ impl Memory {
for &PtrLen { ref map, ptr, len } in &self.allocations[self.executable..] { for &PtrLen { ref map, ptr, len } in &self.allocations[self.executable..] {
if len != 0 && map.is_some() { if len != 0 && map.is_some() {
unsafe { unsafe {
region::protect(ptr, len, region::Protection::ReadExecute) region::protect(ptr, len, region::Protection::READ_EXECUTE)
.expect("unable to make memory readable+executable"); .expect("unable to make memory readable+executable");
} }
} }
@@ -191,7 +191,7 @@ impl Memory {
for &PtrLen { ptr, len } in &self.allocations[self.executable..] { for &PtrLen { ptr, len } in &self.allocations[self.executable..] {
if len != 0 { if len != 0 {
unsafe { unsafe {
region::protect(ptr, len, region::Protection::ReadExecute) region::protect(ptr, len, region::Protection::READ_EXECUTE)
.expect("unable to make memory readable+executable"); .expect("unable to make memory readable+executable");
} }
} }
@@ -208,7 +208,7 @@ impl Memory {
for &PtrLen { ref map, ptr, len } in &self.allocations[self.executable..] { for &PtrLen { ref map, ptr, len } in &self.allocations[self.executable..] {
if len != 0 && map.is_some() { if len != 0 && map.is_some() {
unsafe { unsafe {
region::protect(ptr, len, region::Protection::Read) region::protect(ptr, len, region::Protection::READ)
.expect("unable to make memory readonly"); .expect("unable to make memory readonly");
} }
} }
@@ -220,7 +220,7 @@ impl Memory {
for &PtrLen { ptr, len } in &self.allocations[self.executable..] { for &PtrLen { ptr, len } in &self.allocations[self.executable..] {
if len != 0 { if len != 0 {
unsafe { unsafe {
region::protect(ptr, len, region::Protection::Read) region::protect(ptr, len, region::Protection::READ)
.expect("unable to make memory readonly"); .expect("unable to make memory readonly");
} }
} }

View File

@@ -120,7 +120,7 @@ impl CodeMemory {
if !m.is_empty() { if !m.is_empty() {
unsafe { unsafe {
region::protect(m.as_mut_ptr(), m.len(), region::Protection::ReadExecute) region::protect(m.as_mut_ptr(), m.len(), region::Protection::READ_EXECUTE)
} }
.expect("unable to make memory readonly and executable"); .expect("unable to make memory readonly and executable");
} }

View File

@@ -182,7 +182,7 @@ impl Mmap {
// Commit the accessible size. // Commit the accessible size.
let ptr = self.ptr as *const u8; let ptr = self.ptr as *const u8;
unsafe { region::protect(ptr.add(start), len, region::Protection::ReadWrite) } unsafe { region::protect(ptr.add(start), len, region::Protection::READ_WRITE) }
.map_err(|e| e.to_string()) .map_err(|e| e.to_string())
} }