087e7c94d3
The `syscall` package has been frozen in favor of `x/sys`. As a result, all of the BSDs are supported and do have `mlockall(2)` support in current versions of Go.
19 lines
284 B
Go
19 lines
284 B
Go
// +build darwin
|
|
|
|
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)
|
|
}
|