Skip to content

Commit 7ba8bbc

Browse files
committed
Update comments
1 parent 0b060c7 commit 7ba8bbc

File tree

2 files changed

+7
-5
lines changed

2 files changed

+7
-5
lines changed

src/shims/fs.rs

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -378,9 +378,6 @@ pub trait EvalContextExt<'mir, 'tcx: 'mir>: crate::MiriEvalContextExt<'mir, 'tcx
378378
} else if this.tcx.sess.target.target.target_os == "macos"
379379
&& cmd == this.eval_libc_i32("F_FULLFSYNC")?
380380
{
381-
// On macOS, fsync does not wait for the underlying disk to finish writing, while this
382-
// F_FULLFSYNC operation does. The standard library uses F_FULLFSYNC for both
383-
// File::sync_data() and File::sync_all().
384381
let &[_, _] = check_arg_count(args)?;
385382
if let Some(FileHandle { file, writable: _ }) = this.machine.file_handler.handles.get_mut(&fd) {
386383
let result = file.sync_all();
@@ -1118,6 +1115,11 @@ pub trait EvalContextExt<'mir, 'tcx: 'mir>: crate::MiriEvalContextExt<'mir, 'tcx
11181115
}
11191116

11201117
fn fsync(&mut self, fd_op: OpTy<'tcx, Tag>) -> InterpResult<'tcx, i32> {
1118+
// On macOS, `fsync` (unlike `fcntl(F_FULLFSYNC)`) does not wait for the
1119+
// underlying disk to finish writing. In the interest of host compatibility,
1120+
// we conservatively implement this with `sync_all`, which
1121+
// *does* wait for the disk.
1122+
11211123
let this = self.eval_context_mut();
11221124

11231125
this.check_no_isolation("fsync")?;

tests/run-pass/libc.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -47,10 +47,10 @@ fn test_sync_file_range() {
4747
use std::os::unix::io::AsRawFd;
4848

4949
let path = tmp().join("miri_test_libc_sync_file_range.txt");
50-
// Cleanup before test
50+
// Cleanup before test.
5151
remove_file(&path).ok();
5252

53-
// Write to a file
53+
// Write to a file.
5454
let mut file = File::create(&path).unwrap();
5555
let bytes = b"Hello, World!\n";
5656
file.write(bytes).unwrap();

0 commit comments

Comments
 (0)