implement fd_renumber

This commit is contained in:
Mark McCaskey 2019-04-02 16:26:54 -07:00
parent dd7cfac505
commit ce4676d469
2 changed files with 7 additions and 2 deletions

View File

@ -41,6 +41,7 @@ pub enum Kind {
},
}
#[derive(Clone)]
pub struct Fd {
pub rights: __wasi_rights_t,
pub rights_inheriting: __wasi_rights_t,

View File

@ -657,8 +657,12 @@ pub fn fd_readdir(
/// - `__wasi_fd_t to`
/// Location to copy file descriptor to
pub fn fd_renumber(ctx: &mut Ctx, from: __wasi_fd_t, to: __wasi_fd_t) -> __wasi_errno_t {
debug!("wasi::fd_renumber");
unimplemented!()
debug!("wasi::fd_renumber: from={}, to={}", from, to);
let state = get_wasi_state(ctx);
let fd_entry = wasi_try!(state.fs.fd_map.get(&from).ok_or(__WASI_EBADF));
state.fs.fd_map.insert(to, fd_entry.clone());
__WASI_ESUCCESS
}
/// ### `fd_seek()`