From e7905fdf275fbb520de97df1eccdcd20e3d9aa6f Mon Sep 17 00:00:00 2001 From: EuAndreh Date: Fri, 25 Oct 2024 10:19:35 -0300 Subject: Move code to src/ and tests/ --- src/bolt_openbsd.go | 27 +++++++++++++++++++++++++++ 1 file changed, 27 insertions(+) create mode 100644 src/bolt_openbsd.go (limited to 'src/bolt_openbsd.go') diff --git a/src/bolt_openbsd.go b/src/bolt_openbsd.go new file mode 100644 index 0000000..7058c3d --- /dev/null +++ b/src/bolt_openbsd.go @@ -0,0 +1,27 @@ +package bolt + +import ( + "syscall" + "unsafe" +) + +const ( + msAsync = 1 << iota // perform asynchronous writes + msSync // perform synchronous writes + msInvalidate // invalidate cached data +) + +func msync(db *DB) error { + _, _, errno := syscall.Syscall(syscall.SYS_MSYNC, uintptr(unsafe.Pointer(db.data)), uintptr(db.datasz), msInvalidate) + if errno != 0 { + return errno + } + return nil +} + +func fdatasync(db *DB) error { + if db.data != nil { + return msync(db) + } + return db.file.Sync() +} -- cgit v1.2.3