Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Added basic support to inode in filestat_get (for #3583 and #3239) #3765

Merged
merged 2 commits into from
Apr 13, 2023
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion lib/wasi/src/fs/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,7 @@ pub const MAX_SYMLINKS: u32 = 128;
pub struct Inode(u64);

impl Inode {
fn as_u64(&self) -> u64 {
pub fn as_u64(&self) -> u64 {
self.0
}
}
Expand Down
11 changes: 7 additions & 4 deletions lib/wasi/src/syscalls/wasi/path_filestat_get.rs
Original file line number Diff line number Diff line change
Expand Up @@ -82,10 +82,13 @@ pub(crate) fn path_filestat_get_internal(
path_string,
flags & __WASI_LOOKUP_SYMLINK_FOLLOW != 0,
)?;
if file_inode.is_preopened {
Ok(*file_inode.stat.read().unwrap().deref())
let st_ino = file_inode.ino().as_u64();
let mut stat = if file_inode.is_preopened {
*file_inode.stat.read().unwrap().deref()
} else {
let guard = file_inode.read();
state.fs.get_stat_for_kind(guard.deref())
}
state.fs.get_stat_for_kind(guard.deref())?
};
stat.st_ino = st_ino;
Ok(stat)
}