Port host::__wasi_preopentype_t to Rust

This commit is contained in:
Jakub Konka
2019-05-01 15:23:28 +02:00
committed by Dan Gohman
parent 5c555406ca
commit f7245f40a1
3 changed files with 6 additions and 2 deletions

View File

@@ -103,7 +103,8 @@ fn main() {
.blacklist_item("__WASI_ETIMEDOUT")
.blacklist_item("__WASI_ETXTBSY")
.blacklist_item("__WASI_EXDEV")
.blacklist_item("__WASI_ENOTCAPABLE");
.blacklist_item("__WASI_ENOTCAPABLE")
.blacklist_item("__WASI_PREOPENTYPE_DIR");
let out_path = PathBuf::from(env::var("OUT_DIR").unwrap());

View File

@@ -83,3 +83,6 @@ pub const __WASI_ETIMEDOUT: __wasi_errno_t = 73;
pub const __WASI_ETXTBSY: __wasi_errno_t = 74;
pub const __WASI_EXDEV: __wasi_errno_t = 75;
pub const __WASI_ENOTCAPABLE: __wasi_errno_t = 76;
// pub type __wasi_preopentype_t = u8;
pub const __WASI_PREOPENTYPE_DIR: __wasi_preopentype_t = 0;

View File

@@ -133,7 +133,7 @@ pub fn wasmtime_ssp_fd_prestat_get(
rwlock_rdlock!(prestats);
let ret_code = if let Some(prestat) = fd_prestats_get_entry(prestats, fd) {
(*buf).pr_type = host::__WASI_PREOPENTYPE_DIR as host::__wasi_preopentype_t;
(*buf).pr_type = host::__WASI_PREOPENTYPE_DIR;
unsafe {
let dir_name = ::std::ffi::CStr::from_ptr((*prestat).dir).to_str().unwrap();
(*buf).u.dir.pr_name_len = dir_name.len();