From bfadf72d3f33ddb5e640ad3963d9ed980dcb2bd4 Mon Sep 17 00:00:00 2001 From: Jingkai He Date: Wed, 8 Nov 2017 23:32:35 +0000 Subject: [PATCH] Ensure tsdb can be built on SmartOS/Illumos/Solaris At the moment tsdb cannot be built on Illumos/Solaris due to - An exclude tag against Solaris is added in db_unix.go - We use built-in syscall package, which doesn't have nmmap and munmap support This PR supports build on Illumos/Solaris by remove the Solaris exclude tag in db_unix.go At the same time use golang.org/x/sys/unix package instead of syscall package, since it has Solaris nmmap and munmap implementation. --- db_unix.go | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/db_unix.go b/db_unix.go index 09bb74f3c..02c411d7f 100644 --- a/db_unix.go +++ b/db_unix.go @@ -11,19 +11,20 @@ // See the License for the specific language governing permissions and // limitations under the License. -// +build !windows,!plan9,!solaris +// +build !windows,!plan9 package tsdb import ( "os" - "syscall" + + "golang.org/x/sys/unix" ) func mmap(f *os.File, length int) ([]byte, error) { - return syscall.Mmap(int(f.Fd()), 0, length, syscall.PROT_READ, syscall.MAP_SHARED) + return unix.Mmap(int(f.Fd()), 0, length, unix.PROT_READ, unix.MAP_SHARED) } func munmap(b []byte) (err error) { - return syscall.Munmap(b) + return unix.Munmap(b) }