Update comments
This commit is contained in:
parent
0b060c7364
commit
7ba8bbc49f
@ -378,9 +378,6 @@ pub trait EvalContextExt<'mir, 'tcx: 'mir>: crate::MiriEvalContextExt<'mir, 'tcx
|
||||
} else if this.tcx.sess.target.target.target_os == "macos"
|
||||
&& cmd == this.eval_libc_i32("F_FULLFSYNC")?
|
||||
{
|
||||
// On macOS, fsync does not wait for the underlying disk to finish writing, while this
|
||||
// F_FULLFSYNC operation does. The standard library uses F_FULLFSYNC for both
|
||||
// File::sync_data() and File::sync_all().
|
||||
let &[_, _] = check_arg_count(args)?;
|
||||
if let Some(FileHandle { file, writable: _ }) = this.machine.file_handler.handles.get_mut(&fd) {
|
||||
let result = file.sync_all();
|
||||
@ -1118,6 +1115,11 @@ pub trait EvalContextExt<'mir, 'tcx: 'mir>: crate::MiriEvalContextExt<'mir, 'tcx
|
||||
}
|
||||
|
||||
fn fsync(&mut self, fd_op: OpTy<'tcx, Tag>) -> InterpResult<'tcx, i32> {
|
||||
// On macOS, `fsync` (unlike `fcntl(F_FULLFSYNC)`) does not wait for the
|
||||
// underlying disk to finish writing. In the interest of host compatibility,
|
||||
// we conservatively implement this with `sync_all`, which
|
||||
// *does* wait for the disk.
|
||||
|
||||
let this = self.eval_context_mut();
|
||||
|
||||
this.check_no_isolation("fsync")?;
|
||||
|
@ -47,10 +47,10 @@ fn test_sync_file_range() {
|
||||
use std::os::unix::io::AsRawFd;
|
||||
|
||||
let path = tmp().join("miri_test_libc_sync_file_range.txt");
|
||||
// Cleanup before test
|
||||
// Cleanup before test.
|
||||
remove_file(&path).ok();
|
||||
|
||||
// Write to a file
|
||||
// Write to a file.
|
||||
let mut file = File::create(&path).unwrap();
|
||||
let bytes = b"Hello, World!\n";
|
||||
file.write(bytes).unwrap();
|
||||
|
Loading…
x
Reference in New Issue
Block a user