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