Created
November 15, 2018 03:22
-
-
Save jasongerard/c5430ed0641b401e8e08abe72dc90169 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package main | |
import ( | |
"fmt" | |
"syscall" | |
"golang.org/x/sys/unix" | |
) | |
func main() { | |
err := unix.Mlockall(unix.MCL_CURRENT | unix.MCL_FUTURE) | |
switch err { | |
case nil: | |
fmt.Println("Great Success!") | |
case syscall.ENOMEM: | |
fmt.Println("ENOMEM: nonzero RLIMIT_MEMLOCK soft resource limit") | |
case syscall.EPERM: | |
fmt.Println("EPERM : caller not privileged") | |
default: | |
se := err.(syscall.Errno) | |
fmt.Printf("%v:%s", uintptr(se), err) | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment