Skip to content

Commit

Permalink
Auto merge of #3748 - RalfJung:freebsd-readdir, r=RalfJung
Browse files Browse the repository at this point in the history
readdir_r shim: assume FreeBSD v12+

Blocked on rust-lang/libc#3723 being released and propagating to std.
  • Loading branch information
bors committed Aug 20, 2024
2 parents b355d81 + adca2e4 commit 219c891
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 10 deletions.
16 changes: 8 additions & 8 deletions src/shims/unix/fs.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1204,14 +1204,14 @@ pub trait EvalContextExt<'tcx>: crate::MiriInterpCxExt<'tcx> {
)?;
}
"freebsd" => {
this.write_int(ino, &this.project_field_named(&entry_place, "d_fileno")?)?;
// `d_off` only exists on FreeBSD 12+, but we support v11 as well.
// `libc` uses a build script to determine which version of the API to use,
// and cross-builds always end up using v11.
// To support both v11 and v12+, we dynamically check whether the field exists.
if this.projectable_has_field(&entry_place, "d_off") {
this.write_int(0, &this.project_field_named(&entry_place, "d_off")?)?;
}
#[rustfmt::skip]
this.write_int_fields_named(
&[
("d_fileno", ino.into()),
("d_off", 0),
],
&entry_place,
)?;
}
_ => unreachable!(),
}
Expand Down
4 changes: 2 additions & 2 deletions test_dependencies/Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

0 comments on commit 219c891

Please sign in to comment.