Skip to content

Commit 89cbe0a

Browse files
committed
Add comments
1 parent 725d6bf commit 89cbe0a

File tree

1 file changed

+8
-0
lines changed

1 file changed

+8
-0
lines changed

src/shims/fs.rs

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -173,6 +173,10 @@ trait EvalContextExtPrivate<'mir, 'tcx: 'mir>: crate::MiriEvalContextExt<'mir, '
173173
} else if file_type.is_symlink() {
174174
Ok(this.eval_libc("DT_LNK")?.to_u8()? as i32)
175175
} else {
176+
// Certain file types are only supported when the host is a Unix system.
177+
// (i.e. devices and sockets) If it is, check those cases, if not, fall back to
178+
// DT_UNKNOWN sooner.
179+
176180
#[cfg(unix)]
177181
{
178182
use std::os::unix::fs::FileTypeExt;
@@ -895,6 +899,8 @@ pub trait EvalContextExt<'mir, 'tcx: 'mir>: crate::MiriEvalContextExt<'mir, 'tcx
895899
let c_ushort_layout = this.libc_ty_layout("c_ushort")?;
896900
let c_uchar_layout = this.libc_ty_layout("c_uchar")?;
897901

902+
// If the host is a Unix system, fill in the inode number with its real value.
903+
// If not, use 0 as a fallback value.
898904
#[cfg(unix)]
899905
let ino = std::os::unix::fs::DirEntryExt::ino(&dir_entry);
900906
#[cfg(not(unix))]
@@ -969,6 +975,8 @@ pub trait EvalContextExt<'mir, 'tcx: 'mir>: crate::MiriEvalContextExt<'mir, 'tcx
969975
let c_ushort_layout = this.libc_ty_layout("c_ushort")?;
970976
let c_uchar_layout = this.libc_ty_layout("c_uchar")?;
971977

978+
// If the host is a Unix system, fill in the inode number with its real value.
979+
// If not, use 0 as a fallback value.
972980
#[cfg(unix)]
973981
let ino = std::os::unix::fs::DirEntryExt::ino(&dir_entry);
974982
#[cfg(not(unix))]

0 commit comments

Comments
 (0)