aboutsummaryrefslogtreecommitdiff
path: root/bolt_linux.go
diff options
context:
space:
mode:
authorBen Johnson <benbjohnson@yahoo.com>2014-06-11 11:11:21 -0600
committerBen Johnson <benbjohnson@yahoo.com>2014-06-11 11:11:21 -0600
commitc2577db1c22e0bb64ea3df16e9424e6dce1d55ab (patch)
tree4deb66bd7914dd52129b62bfb99ee2238e76af66 /bolt_linux.go
parentMerge pull request #189 from benbjohnson/increase-max-nodes-per-page (diff)
downloaddedo-c2577db1c22e0bb64ea3df16e9424e6dce1d55ab.tar.gz
dedo-c2577db1c22e0bb64ea3df16e9424e6dce1d55ab.tar.xz
Add Windows support.
Diffstat (limited to 'bolt_linux.go')
-rw-r--r--bolt_linux.go21
1 files changed, 21 insertions, 0 deletions
diff --git a/bolt_linux.go b/bolt_linux.go
index 4351db5..9aba955 100644
--- a/bolt_linux.go
+++ b/bolt_linux.go
@@ -7,6 +7,27 @@ import (
var odirect = syscall.O_DIRECT
+// fdatasync flushes written data to a file descriptor.
func fdatasync(f *os.File) error {
return syscall.Fdatasync(int(f.Fd()))
}
+
+// flock acquires an advisory lock on a file descriptor.
+func flock(f *os.File) error {
+ return syscall.Flock(int(f.Fd()), syscall.LOCK_EX)
+}
+
+// funlock releases an advisory lock on a file descriptor.
+func funlock(f *os.File) error {
+ return syscall.Flock(int(f.Fd()), syscall.LOCK_UN)
+}
+
+// mmap memory maps a file to a byte slice.
+func mmap(f *os.File, sz int) ([]byte, error) {
+ return syscall.Mmap(int(f.Fd()), 0, sz, syscall.PROT_READ, syscall.MAP_SHARED)
+}
+
+// munmap unmaps a pointer from a file.
+func munmap(b []byte) error {
+ return syscall.Munmap(b)
+}