[helper] support mlock on Solaris/SmartOS

This commit is contained in:
Charles Phillips
2015-12-15 11:28:16 -08:00
parent 58c356f1aa
commit 2d7023731f
2 changed files with 18 additions and 1 deletions

View File

@@ -0,0 +1,17 @@
// +build solaris
package mlock
import (
"syscall"
"golang.org/x/sys/unix"
)
func init() {
supported = true
}
func lockMemory() error {
// Mlockall prevents all current and future pages from being swapped out.
return unix.Mlockall(syscall.MCL_CURRENT | syscall.MCL_FUTURE)
}

View File

@@ -1,4 +1,4 @@
// +build windows plan9 darwin freebsd openbsd solaris // +build windows plan9 darwin freebsd openbsd
package mlock package mlock