Skip to content

Commit a113fa4

Browse files
no need to support macos
1 parent 3227c61 commit a113fa4

File tree

2 files changed

+6
-22
lines changed

2 files changed

+6
-22
lines changed

src/shims/unix/fs.rs

Lines changed: 6 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -903,10 +903,7 @@ pub trait EvalContextExt<'tcx>: crate::MiriInterpCxExt<'tcx> {
903903
fn readdir64(&mut self, dirent_type: &str, dirp_op: &OpTy<'tcx>) -> InterpResult<'tcx, Scalar> {
904904
let this = self.eval_context_mut();
905905

906-
if !matches!(
907-
&*this.tcx.sess.target.os,
908-
"linux" | "solaris" | "illumos" | "macos" | "freebsd"
909-
) {
906+
if !matches!(&*this.tcx.sess.target.os, "linux" | "solaris" | "illumos" | "freebsd") {
910907
panic!("`linux_solaris_readdir64` should not be called on {}", this.tcx.sess.target.os);
911908
}
912909

@@ -955,16 +952,6 @@ pub trait EvalContextExt<'tcx>: crate::MiriInterpCxExt<'tcx> {
955952
// pub d_namlen: uint8_t,
956953
// pub d_name: [c_char; 256]
957954
// }
958-
//
959-
// On Macos:
960-
// pub struct dirent {
961-
// pub d_ino: u64,
962-
// pub d_seekoff: u64,
963-
// pub d_reclen: u16,
964-
// pub d_namlen: u16,
965-
// pub d_type: u8,
966-
// pub d_name: [c_char; 1024],
967-
// }
968955

969956
let mut name = dir_entry.file_name(); // not a Path as there are no separators!
970957
name.push("\0"); // Add a NUL terminator
@@ -995,13 +982,15 @@ pub trait EvalContextExt<'tcx>: crate::MiriInterpCxExt<'tcx> {
995982
// Write common fields
996983
let ino_name =
997984
if this.tcx.sess.target.os == "freebsd" { "d_fileno" } else { "d_ino" };
998-
let off_name =
999-
if this.tcx.sess.target.os == "macos" { "d_seekoff" } else { "d_off" };
1000985
this.write_int_fields_named(
1001-
&[(ino_name, ino.into()), (off_name, 0), ("d_reclen", size.into())],
986+
&[(ino_name, ino.into()), ("d_reclen", size.into())],
1002987
&entry,
1003988
)?;
1004989

990+
if let Some(d_off) = this.try_project_field_named(&entry, "d_off")? {
991+
this.write_null(&d_off)?;
992+
}
993+
1005994
if let Some(d_namlen) = this.try_project_field_named(&entry, "d_namlen")? {
1006995
this.write_int(name_len.strict_sub(1), &d_namlen)?;
1007996
}

src/shims/unix/macos/foreign_items.rs

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -72,11 +72,6 @@ pub trait EvalContextExt<'tcx>: crate::MiriInterpCxExt<'tcx> {
7272
let result = this.macos_fbsd_readdir_r(dirp, entry, result)?;
7373
this.write_scalar(result, dest)?;
7474
}
75-
"readdir" | "readdir$INODE64" => {
76-
let [dirp] = this.check_shim_sig_lenient(abi, CanonAbi::C, link_name, args)?;
77-
let result = this.readdir64("dirent", dirp)?;
78-
this.write_scalar(result, dest)?;
79-
}
8075
"realpath$DARWIN_EXTSN" => {
8176
let [path, resolved_path] =
8277
this.check_shim_sig_lenient(abi, CanonAbi::C, link_name, args)?;

0 commit comments

Comments
 (0)