Files
sqlite3/vfs/os_linux.go

26 lines
406 B
Go
Raw Normal View History

2023-06-01 18:11:37 +01:00
package vfs
2023-03-17 17:13:03 +00:00
import (
"os"
"golang.org/x/sys/unix"
)
2023-03-29 15:01:25 +01:00
func osSync(file *os.File, fullsync, dataonly bool) error {
2023-03-17 17:13:03 +00:00
if dataonly {
_, _, err := unix.Syscall(unix.SYS_FDATASYNC, file.Fd(), 0, 0)
if err != 0 {
return err
}
return nil
}
return file.Sync()
}
2023-03-29 15:01:25 +01:00
func osAllocate(file *os.File, size int64) error {
2023-03-17 17:13:03 +00:00
if size == 0 {
return nil
}
return unix.Fallocate(int(file.Fd()), 0, 0, size)
}