From b1030d31814f85e8c6619ce1e0246ee214905446 Mon Sep 17 00:00:00 2001 From: Lachlan Sneff Date: Fri, 29 Mar 2019 11:03:21 -0700 Subject: [PATCH] Add prestat_t --- lib/wasi/src/syscalls/mod.rs | 2 +- lib/wasi/src/syscalls/types.rs | 24 +++++++++++++++++++++++- 2 files changed, 24 insertions(+), 2 deletions(-) diff --git a/lib/wasi/src/syscalls/mod.rs b/lib/wasi/src/syscalls/mod.rs index 0c0298383..d72cbf466 100644 --- a/lib/wasi/src/syscalls/mod.rs +++ b/lib/wasi/src/syscalls/mod.rs @@ -238,7 +238,7 @@ pub fn fd_pread( pub fn fd_prestat_get( ctx: &mut Ctx, fd: __wasi_fd_t, - buf: WasmPtr<__wasi_fdstat_t>, + buf: WasmPtr<__wasi_prestat_t>, ) -> __wasi_errno_t { unimplemented!() } diff --git a/lib/wasi/src/syscalls/types.rs b/lib/wasi/src/syscalls/types.rs index 7995e86be..0221b1690 100644 --- a/lib/wasi/src/syscalls/types.rs +++ b/lib/wasi/src/syscalls/types.rs @@ -34,7 +34,7 @@ pub const __WASI_DIRCOOKIE_START: u64 = 0; pub struct __wasi_dirent_t { pub d_next: __wasi_dircookie_t, pub d_ino: __wasi_inode_t, - pub _namlen: u32, + pub d_namlen: u32, pub d_type: __wasi_filetype_t, } @@ -161,6 +161,28 @@ pub const __WASI_FDFLAG_NONBLOCK: u16 = 1 << 2; pub const __WASI_FDFLAG_RSYNC: u16 = 1 << 3; pub const __WASI_FDFLAG_SYNC: u16 = 1 << 4; +pub type __wasi_preopentype_t = u8; +pub const __WASI_PREOPENTYPE_DIR: u8 = 0; + +#[derive(Debug, Copy, Clone, PartialEq, Eq)] +#[repr(C)] +pub struct __wasi_prestat_u_dir_t { + pr_name_len: u32, +} + +#[derive(Copy, Clone)] +#[repr(C)] +pub union __wasi_prestat_u { + dir: __wasi_prestat_u_dir_t, +} + +#[derive(Copy, Clone)] +#[repr(C)] +pub struct __wasi_prestat_t { + pr_type: __wasi_preopentype_t, + u: __wasi_prestat_u, +} + #[derive(Debug, Copy, Clone, PartialEq, Eq)] #[repr(C)] pub struct __wasi_fdstat_t {