Skip to content

Instantly share code, notes, and snippets.

@graphaelli
Created March 21, 2018 20:50
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save graphaelli/a319b989f5e1cf8d9eaa165d561f7b7c to your computer and use it in GitHub Desktop.
Save graphaelli/a319b989f5e1cf8d9eaa165d561f7b7c to your computer and use it in GitHub Desktop.
fetch kern.ipc.somaxconn
if somaxconn, err := unix.Sysctl("kern.ipc.somaxconn"); err != nil {
panic(err)
} else {
var backlog uint16
r := strings.NewReader(somaxconn)
if err := binary.Read(r, binary.LittleEndian, &backlog); err != nil {
fmt.Println("binary.Read failed:", err)
}
fmt.Println(backlog)
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment