bolt_openbsd.go 519 B

123456789101112131415161718192021222324252627
  1. package bbolt
  2. import (
  3. "syscall"
  4. "unsafe"
  5. )
  6. const (
  7. msAsync = 1 << iota // perform asynchronous writes
  8. msSync // perform synchronous writes
  9. msInvalidate // invalidate cached data
  10. )
  11. func msync(db *DB) error {
  12. _, _, errno := syscall.Syscall(syscall.SYS_MSYNC, uintptr(unsafe.Pointer(db.data)), uintptr(db.datasz), msInvalidate)
  13. if errno != 0 {
  14. return errno
  15. }
  16. return nil
  17. }
  18. func fdatasync(db *DB) error {
  19. if db.data != nil {
  20. return msync(db)
  21. }
  22. return db.file.Sync()
  23. }