func main() { flag.Usage = usage flag.Parse() if flag.NArg() < 1 { usage() } for _, name := range flag.Args() { f, err := os.OpenFile(name, syscall.O_RDONLY|syscall.O_NOATIME|syscall.O_NOCTTY|syscall.O_CLOEXEC, 0644) if ek(err) { continue } if *dflag { err = syscall.Fdatasync(int(f.Fd())) } else { err = syscall.Fsync(int(f.Fd())) } ek(err) ek(f.Close()) } os.Exit(status) }
func Fdatasync(fd uintptr) (err error) { return syscall.Fdatasync(int(fd)) }
// fdatasync flushes written data to a file descriptor. func fdatasync(db *DB) error { return syscall.Fdatasync(int(db.file.Fd())) }
// Fdatasync is similar to fsync(), but does not flush modified metadata // unless that metadata is needed in order to allow a subsequent data retrieval // to be correctly handled. func Fdatasync(f *os.File) error { return syscall.Fdatasync(int(f.Fd())) }