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. 4 5 package net 6 7 import ( 8 "os" 9 "syscall" 10 ) 11 12 func maxListenerBacklog() int { 13 // TODO: Implement this 14 // NOTE: Never return a number bigger than 1<<16 - 1. See issue 5030. 15 return syscall.SOMAXCONN 16 } 17 18 func sysSocket(family, sotype, proto int) (syscall.Handle, error) { 19 // See ../syscall/exec_unix.go for description of ForkLock. 20 syscall.ForkLock.RLock() 21 s, err := socketFunc(family, sotype, proto) 22 if err == nil { 23 syscall.CloseOnExec(s) 24 } 25 syscall.ForkLock.RUnlock() 26 if err != nil { 27 return syscall.InvalidHandle, os.NewSyscallError("socket", err) 28 } 29 return s, nil 30 } 31