mirror of https://github.com/etcd-io/bbolt.git
Avoid syscall.Syscall use on OpenBSD
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>pull/405/head
parent
505fc0f7af
commit
46437cea06
|
@ -1,22 +1,11 @@
|
||||||
package bbolt
|
package bbolt
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"syscall"
|
"golang.org/x/sys/unix"
|
||||||
"unsafe"
|
|
||||||
)
|
|
||||||
|
|
||||||
const (
|
|
||||||
msAsync = 1 << iota // perform asynchronous writes
|
|
||||||
msSync // perform synchronous writes
|
|
||||||
msInvalidate // invalidate cached data
|
|
||||||
)
|
)
|
||||||
|
|
||||||
func msync(db *DB) error {
|
func msync(db *DB) error {
|
||||||
_, _, errno := syscall.Syscall(syscall.SYS_MSYNC, uintptr(unsafe.Pointer(db.data)), uintptr(db.datasz), msInvalidate)
|
return unix.Msync(db.data[:db.datasz], unix.MS_INVALIDATE)
|
||||||
if errno != 0 {
|
|
||||||
return errno
|
|
||||||
}
|
|
||||||
return nil
|
|
||||||
}
|
}
|
||||||
|
|
||||||
func fdatasync(db *DB) error {
|
func fdatasync(db *DB) error {
|
||||||
|
|
Loading…
Reference in New Issue