mirror of
https://github.com/etcd-io/bbolt.git
synced 2025-05-01 13:13:32 +00:00
Syscall numbers are not stable on OpenBSD, and hardcoding the msync syscall number will break bbolt on future versions of OpenBSD. Use the libc wrapper provided by golang.org/x/sys/unix instead. Signed-off-by: Josh Rickmar <jrick@zettaport.com>
17 lines
241 B
Go
17 lines
241 B
Go
package bbolt
|
|
|
|
import (
|
|
"golang.org/x/sys/unix"
|
|
)
|
|
|
|
func msync(db *DB) error {
|
|
return unix.Msync(db.data[:db.datasz], unix.MS_INVALIDATE)
|
|
}
|
|
|
|
func fdatasync(db *DB) error {
|
|
if db.data != nil {
|
|
return msync(db)
|
|
}
|
|
return db.file.Sync()
|
|
}
|