Skip to content

Commit c2bcab5

Browse files
committed
improve docs
1 parent 9e9a090 commit c2bcab5

File tree

3 files changed

+12
-0
lines changed

3 files changed

+12
-0
lines changed

src/shims/foreign_items/posix/linux.rs

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,9 @@ pub trait EvalContextExt<'mir, 'tcx: 'mir>: crate::MiriEvalContextExt<'mir, 'tcx
1919
}
2020

2121
// File related shims
22+
23+
// The only reason this is not in the `posix` module is because the `macos` item has a
24+
// different name.
2225
"close" => {
2326
let result = this.close(args[0])?;
2427
this.write_scalar(Scalar::from_int(result, dest.layout.size), dest)?;
@@ -56,6 +59,8 @@ pub trait EvalContextExt<'mir, 'tcx: 'mir>: crate::MiriEvalContextExt<'mir, 'tcx
5659
// so skip over it.
5760
getrandom(this, &args[1..], dest)?;
5861
}
62+
// `statx` is used by `libstd` to retrieve metadata information in `linux`
63+
// instead of using `stat`,`lstat` or `fstat` as in the `macos` platform.
5964
id if id == sys_statx => {
6065
// The first argument is the syscall id,
6166
// so skip over it.

src/shims/foreign_items/posix/macos.rs

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,9 @@ pub trait EvalContextExt<'mir, 'tcx: 'mir>: crate::MiriEvalContextExt<'mir, 'tcx
1919
}
2020

2121
// File related shims
22+
23+
// The only reason this is not in the `posix` module is because the `linux` item has a
24+
// different name.
2225
"close$NOCANCEL" => {
2326
let result = this.close(args[0])?;
2427
this.write_scalar(Scalar::from_int(result, dest.layout.size), dest)?;

src/shims/fs.rs

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -383,6 +383,10 @@ pub trait EvalContextExt<'mir, 'tcx: 'mir>: crate::MiriEvalContextExt<'mir, 'tcx
383383
macos_stat_write_buf(this, metadata, buf_op)
384384
}
385385

386+
/// Emulate `stat` or `lstat` on the `macos` platform. This function is not intended to be
387+
/// called directly from `emulate_foreign_item_by_name`, so it does not check if isolation is
388+
/// disabled or if the target platform is the correct one. Please use `macos_stat` or
389+
/// `macos_lstat` instead.
386390
fn macos_stat_or_lstat(
387391
&mut self,
388392
follow_symlink: bool,

0 commit comments

Comments
 (0)