Use the libstd instead of the errno crate in wasmtime-runtime. (#408)
Rust's standard library now has a way to read the OS errno value, so use that instead of depending on the errno crate in wasmtime-runtime.
This commit is contained in:
@@ -35,7 +35,6 @@ pretty_env_logger = "0.3.0"
|
|||||||
file-per-thread-logger = "0.1.1"
|
file-per-thread-logger = "0.1.1"
|
||||||
wabt = "0.9.2"
|
wabt = "0.9.2"
|
||||||
libc = "0.2.60"
|
libc = "0.2.60"
|
||||||
errno = "0.2.4"
|
|
||||||
rayon = "1.1"
|
rayon = "1.1"
|
||||||
wasm-webidl-bindings = "0.5"
|
wasm-webidl-bindings = "0.5"
|
||||||
|
|
||||||
|
|||||||
@@ -18,7 +18,6 @@ wasmtime-environ = { path = "../wasmtime-environ", default-features = false }
|
|||||||
region = "2.0.0"
|
region = "2.0.0"
|
||||||
lazy_static = "1.2.0"
|
lazy_static = "1.2.0"
|
||||||
libc = { version = "0.2.60", default-features = false }
|
libc = { version = "0.2.60", default-features = false }
|
||||||
errno = "0.2.4"
|
|
||||||
memoffset = "0.5.1"
|
memoffset = "0.5.1"
|
||||||
failure = { version = "0.1.3", default-features = false }
|
failure = { version = "0.1.3", default-features = false }
|
||||||
failure_derive = { version = "0.1.3", default-features = false }
|
failure_derive = { version = "0.1.3", default-features = false }
|
||||||
|
|||||||
@@ -5,10 +5,10 @@ use alloc::string::{String, ToString};
|
|||||||
use alloc::vec::Vec;
|
use alloc::vec::Vec;
|
||||||
use core::ptr;
|
use core::ptr;
|
||||||
use core::slice;
|
use core::slice;
|
||||||
use errno;
|
|
||||||
#[cfg(not(target_os = "windows"))]
|
#[cfg(not(target_os = "windows"))]
|
||||||
use libc;
|
use libc;
|
||||||
use region;
|
use region;
|
||||||
|
use std::io;
|
||||||
|
|
||||||
/// Round `size` up to the nearest multiple of `page_size`.
|
/// Round `size` up to the nearest multiple of `page_size`.
|
||||||
fn round_up_to_page_size(size: usize, page_size: usize) -> usize {
|
fn round_up_to_page_size(size: usize, page_size: usize) -> usize {
|
||||||
@@ -74,7 +74,7 @@ impl Mmap {
|
|||||||
)
|
)
|
||||||
};
|
};
|
||||||
if ptr as isize == -1_isize {
|
if ptr as isize == -1_isize {
|
||||||
return Err(errno::errno().to_string());
|
return Err(io::Error::last_os_error().to_string());
|
||||||
}
|
}
|
||||||
|
|
||||||
Self {
|
Self {
|
||||||
@@ -94,7 +94,7 @@ impl Mmap {
|
|||||||
)
|
)
|
||||||
};
|
};
|
||||||
if ptr as isize == -1_isize {
|
if ptr as isize == -1_isize {
|
||||||
return Err(errno::errno().to_string());
|
return Err(io::Error::last_os_error().to_string());
|
||||||
}
|
}
|
||||||
|
|
||||||
let mut result = Self {
|
let mut result = Self {
|
||||||
@@ -138,7 +138,7 @@ impl Mmap {
|
|||||||
)
|
)
|
||||||
};
|
};
|
||||||
if ptr.is_null() {
|
if ptr.is_null() {
|
||||||
return Err(errno::errno().to_string());
|
return Err(io::Error::last_os_error().to_string());
|
||||||
}
|
}
|
||||||
|
|
||||||
Self {
|
Self {
|
||||||
@@ -150,7 +150,7 @@ impl Mmap {
|
|||||||
let ptr =
|
let ptr =
|
||||||
unsafe { VirtualAlloc(ptr::null_mut(), mapping_size, MEM_RESERVE, PAGE_NOACCESS) };
|
unsafe { VirtualAlloc(ptr::null_mut(), mapping_size, MEM_RESERVE, PAGE_NOACCESS) };
|
||||||
if ptr.is_null() {
|
if ptr.is_null() {
|
||||||
return Err(errno::errno().to_string());
|
return Err(io::Error::last_os_error().to_string());
|
||||||
}
|
}
|
||||||
|
|
||||||
let mut result = Self {
|
let mut result = Self {
|
||||||
@@ -208,7 +208,7 @@ impl Mmap {
|
|||||||
}
|
}
|
||||||
.is_null()
|
.is_null()
|
||||||
{
|
{
|
||||||
return Err(errno::errno().to_string());
|
return Err(io::Error::last_os_error().to_string());
|
||||||
}
|
}
|
||||||
|
|
||||||
Ok(())
|
Ok(())
|
||||||
@@ -245,7 +245,7 @@ impl Drop for Mmap {
|
|||||||
fn drop(&mut self) {
|
fn drop(&mut self) {
|
||||||
if self.len != 0 {
|
if self.len != 0 {
|
||||||
let r = unsafe { libc::munmap(self.ptr as *mut libc::c_void, self.len) };
|
let r = unsafe { libc::munmap(self.ptr as *mut libc::c_void, self.len) };
|
||||||
assert_eq!(r, 0, "munmap failed: {}", errno::errno());
|
assert_eq!(r, 0, "munmap failed: {}", io::Error::last_os_error());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user