diff options
author | Ben Johnson <benbjohnson@yahoo.com> | 2014-06-11 11:11:21 -0600 |
---|---|---|
committer | Ben Johnson <benbjohnson@yahoo.com> | 2014-06-11 11:11:21 -0600 |
commit | c2577db1c22e0bb64ea3df16e9424e6dce1d55ab (patch) | |
tree | 4deb66bd7914dd52129b62bfb99ee2238e76af66 /bolt_darwin.go | |
parent | Merge pull request #189 from benbjohnson/increase-max-nodes-per-page (diff) | |
download | dedo-c2577db1c22e0bb64ea3df16e9424e6dce1d55ab.tar.gz dedo-c2577db1c22e0bb64ea3df16e9424e6dce1d55ab.tar.xz |
Add Windows support.
Diffstat (limited to 'bolt_darwin.go')
-rw-r--r-- | bolt_darwin.go | 33 |
1 files changed, 33 insertions, 0 deletions
diff --git a/bolt_darwin.go b/bolt_darwin.go new file mode 100644 index 0000000..557de72 --- /dev/null +++ b/bolt_darwin.go @@ -0,0 +1,33 @@ +package bolt + +import ( + "os" + "syscall" +) + +var odirect int + +// fdatasync flushes written data to a file descriptor. +func fdatasync(f *os.File) error { + return f.Sync() +} + +// 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) +} |