We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent a2bbf7d commit d602a6bCopy full SHA for d602a6b
src/libstd/sys/unix/fs.rs
@@ -526,8 +526,15 @@ impl File {
526
}
527
528
pub fn fsync(&self) -> io::Result<()> {
529
- cvt_r(|| unsafe { libc::fsync(self.0.raw()) })?;
530
- Ok(())
+ cvt_r(|| unsafe { os_fsync(self.0.raw()) })?;
+ return Ok(());
531
+
532
+ #[cfg(any(target_os = "macos", target_os = "ios"))]
533
+ unsafe fn os_fsync(fd: c_int) -> c_int {
534
+ libc::fcntl(fd, libc::F_FULLFSYNC)
535
+ }
536
+ #[cfg(not(any(target_os = "macos", target_os = "ios")))]
537
+ unsafe fn os_fsync(fd: c_int) -> c_int { libc::fsync(fd) }
538
539
540
pub fn datasync(&self) -> io::Result<()> {
0 commit comments