2016-05-10 23:39:54 +00:00
|
|
|
// +build darwin dragonfly freebsd linux openbsd solaris
|
2016-04-05 19:18:19 +00:00
|
|
|
|
|
|
|
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)
|
|
|
|
}
|