| // Copyright 2009 The Go Authors. All rights reserved. |
| // Use of this source code is governed by a BSD-style |
| // license that can be found in the LICENSE file. |
| // +build darwin dragonfly freebsd netbsd openbsd |
| func maxListenerBacklog() int { |
| case "darwin", "freebsd": |
| n, err = syscall.SysctlUint32("kern.ipc.somaxconn") |
| // NOTE: NetBSD has no somaxconn-like kernel state so far |
| n, err = syscall.SysctlUint32("kern.somaxconn") |
| if n == 0 || err != nil { |
| // FreeBSD stores the backlog in a uint16, as does Linux. |
| // Assume the other BSDs do too. Truncate number to avoid wrapping. |