From 1a35c440e8cc95e05d5021ee5b6a5cb1a5623772 Mon Sep 17 00:00:00 2001 From: AudriusButkevicius Date: Thu, 14 Apr 2016 19:28:06 -0400 Subject: [PATCH] Add solaris support back in --- cmd/strelaypoolsrv/Godeps/Godeps.json | 4 ++-- .../oschwald/maxminddb-golang/mmap_unix.go | 6 ++++-- .../oschwald/maxminddb-golang/mmap_windows.go | 17 +++++++++-------- 3 files changed, 15 insertions(+), 12 deletions(-) diff --git a/cmd/strelaypoolsrv/Godeps/Godeps.json b/cmd/strelaypoolsrv/Godeps/Godeps.json index 80cfa7c4f..e7bc322de 100644 --- a/cmd/strelaypoolsrv/Godeps/Godeps.json +++ b/cmd/strelaypoolsrv/Godeps/Godeps.json @@ -36,8 +36,8 @@ }, { "ImportPath": "github.com/oschwald/maxminddb-golang", - "Comment": "v0.2.0-41-gcf814d2", - "Rev": "cf814d2e9ee3d6ef5b756c0696548eb2f5508e03" + "Comment": "v0.2.0-41-gbfd1341", + "Rev": "bfd134128faa57c37ef41fff5fb1a9ca94450a9b" }, { "ImportPath": "github.com/syncthing/syncthing/lib/dialer", diff --git a/cmd/strelaypoolsrv/Godeps/_workspace/src/github.com/oschwald/maxminddb-golang/mmap_unix.go b/cmd/strelaypoolsrv/Godeps/_workspace/src/github.com/oschwald/maxminddb-golang/mmap_unix.go index 835bc8f00..99f98cab6 100644 --- a/cmd/strelaypoolsrv/Godeps/_workspace/src/github.com/oschwald/maxminddb-golang/mmap_unix.go +++ b/cmd/strelaypoolsrv/Godeps/_workspace/src/github.com/oschwald/maxminddb-golang/mmap_unix.go @@ -4,12 +4,14 @@ package maxminddb import ( "syscall" + + "golang.org/x/sys/unix" ) func mmap(fd int, length int) (data []byte, err error) { - return syscall.Mmap(fd, 0, length, syscall.PROT_READ, syscall.MAP_SHARED) + return unix.Mmap(fd, 0, length, syscall.PROT_READ, syscall.MAP_SHARED) } func munmap(b []byte) (err error) { - return syscall.Munmap(b) + return unix.Munmap(b) } diff --git a/cmd/strelaypoolsrv/Godeps/_workspace/src/github.com/oschwald/maxminddb-golang/mmap_windows.go b/cmd/strelaypoolsrv/Godeps/_workspace/src/github.com/oschwald/maxminddb-golang/mmap_windows.go index 06bb99845..083f096c9 100644 --- a/cmd/strelaypoolsrv/Godeps/_workspace/src/github.com/oschwald/maxminddb-golang/mmap_windows.go +++ b/cmd/strelaypoolsrv/Godeps/_workspace/src/github.com/oschwald/maxminddb-golang/mmap_windows.go @@ -11,24 +11,25 @@ import ( "os" "reflect" "sync" - "syscall" "unsafe" + + "golang.org/x/sys/windows" ) type memoryMap []byte // Windows var handleLock sync.Mutex -var handleMap = map[uintptr]syscall.Handle{} +var handleMap = map[uintptr]windows.Handle{} func mmap(fd int, length int) (data []byte, err error) { - h, errno := syscall.CreateFileMapping(syscall.Handle(fd), nil, - uint32(syscall.PAGE_READONLY), 0, uint32(length), nil) + h, errno := windows.CreateFileMapping(windows.Handle(fd), nil, + uint32(windows.PAGE_READONLY), 0, uint32(length), nil) if h == 0 { return nil, os.NewSyscallError("CreateFileMapping", errno) } - addr, errno := syscall.MapViewOfFile(h, uint32(syscall.FILE_MAP_READ), 0, + addr, errno := windows.MapViewOfFile(h, uint32(windows.FILE_MAP_READ), 0, 0, uintptr(length)) if addr == 0 { return nil, os.NewSyscallError("MapViewOfFile", errno) @@ -51,7 +52,7 @@ func (m *memoryMap) header() *reflect.SliceHeader { } func flush(addr, len uintptr) error { - errno := syscall.FlushViewOfFile(addr, len) + errno := windows.FlushViewOfFile(addr, len) return os.NewSyscallError("FlushViewOfFile", errno) } @@ -63,7 +64,7 @@ func munmap(b []byte) (err error) { length := uintptr(dh.Len) flush(addr, length) - err = syscall.UnmapViewOfFile(addr) + err = windows.UnmapViewOfFile(addr) if err != nil { return err } @@ -77,6 +78,6 @@ func munmap(b []byte) (err error) { } delete(handleMap, addr) - e := syscall.CloseHandle(syscall.Handle(handle)) + e := windows.CloseHandle(windows.Handle(handle)) return os.NewSyscallError("CloseHandle", e) }