Skip to content

Commit

Permalink
Add prestat_t
Browse files Browse the repository at this point in the history
  • Loading branch information
lachlansneff committed Mar 29, 2019
1 parent 39ccf40 commit b1030d3
Show file tree
Hide file tree
Showing 2 changed files with 24 additions and 2 deletions.
2 changes: 1 addition & 1 deletion lib/wasi/src/syscalls/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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!()
}
Expand Down
24 changes: 23 additions & 1 deletion lib/wasi/src/syscalls/types.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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,
}

Expand Down Expand Up @@ -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 {
Expand Down

0 comments on commit b1030d3

Please sign in to comment.