aboutsummaryrefslogtreecommitdiff
path: root/src/bolt_openbsd.go
diff options
context:
space:
mode:
authorEuAndreh <eu@euandre.org>2024-10-25 10:19:35 -0300
committerEuAndreh <eu@euandre.org>2024-10-25 10:19:35 -0300
commite7905fdf275fbb520de97df1eccdcd20e3d9aa6f (patch)
treed211118bf0c7bb20415367765f5eda66c8bdec86 /src/bolt_openbsd.go
parentMerge pull request #748 from Chyroc/add/tx-copy-deprecated (diff)
downloaddedo-e7905fdf275fbb520de97df1eccdcd20e3d9aa6f.tar.gz
dedo-e7905fdf275fbb520de97df1eccdcd20e3d9aa6f.tar.xz
Move code to src/ and tests/
Diffstat (limited to 'src/bolt_openbsd.go')
-rw-r--r--src/bolt_openbsd.go27
1 files changed, 27 insertions, 0 deletions
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()
+}