Port host::__wasi_preopentype_t to Rust
This commit is contained in:
@@ -103,7 +103,8 @@ fn main() {
|
|||||||
.blacklist_item("__WASI_ETIMEDOUT")
|
.blacklist_item("__WASI_ETIMEDOUT")
|
||||||
.blacklist_item("__WASI_ETXTBSY")
|
.blacklist_item("__WASI_ETXTBSY")
|
||||||
.blacklist_item("__WASI_EXDEV")
|
.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());
|
let out_path = PathBuf::from(env::var("OUT_DIR").unwrap());
|
||||||
|
|
||||||
|
|||||||
@@ -83,3 +83,6 @@ pub const __WASI_ETIMEDOUT: __wasi_errno_t = 73;
|
|||||||
pub const __WASI_ETXTBSY: __wasi_errno_t = 74;
|
pub const __WASI_ETXTBSY: __wasi_errno_t = 74;
|
||||||
pub const __WASI_EXDEV: __wasi_errno_t = 75;
|
pub const __WASI_EXDEV: __wasi_errno_t = 75;
|
||||||
pub const __WASI_ENOTCAPABLE: __wasi_errno_t = 76;
|
pub const __WASI_ENOTCAPABLE: __wasi_errno_t = 76;
|
||||||
|
|
||||||
|
// pub type __wasi_preopentype_t = u8;
|
||||||
|
pub const __WASI_PREOPENTYPE_DIR: __wasi_preopentype_t = 0;
|
||||||
|
|||||||
@@ -133,7 +133,7 @@ pub fn wasmtime_ssp_fd_prestat_get(
|
|||||||
rwlock_rdlock!(prestats);
|
rwlock_rdlock!(prestats);
|
||||||
|
|
||||||
let ret_code = if let Some(prestat) = fd_prestats_get_entry(prestats, fd) {
|
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 {
|
unsafe {
|
||||||
let dir_name = ::std::ffi::CStr::from_ptr((*prestat).dir).to_str().unwrap();
|
let dir_name = ::std::ffi::CStr::from_ptr((*prestat).dir).to_str().unwrap();
|
||||||
(*buf).u.dir.pr_name_len = dir_name.len();
|
(*buf).u.dir.pr_name_len = dir_name.len();
|
||||||
|
|||||||
Reference in New Issue
Block a user