Fdatasync.

This commit is contained in:
Nuno Cruces
2024-03-21 15:04:59 +00:00
parent 617982f947
commit b7d22e8fbf

View File

@@ -8,15 +8,9 @@ import (
"golang.org/x/sys/unix"
)
func osSync(file *os.File, _ /*fullsync*/, dataonly bool) error {
if dataonly {
_, _, err := unix.Syscall(unix.SYS_FDATASYNC, file.Fd(), 0, 0)
if err != 0 {
return err
}
return nil
}
return file.Sync()
func osSync(file *os.File, _ /*fullsync*/, _ /*dataonly*/ bool) error {
// SQLite trusts Linux's fdatasync for all fsync's.
return unix.Fdatasync(int(file.Fd()))
}
func osAllocate(file *os.File, size int64) error {