Retro68/gcc/libgo/go/net/sock_windows.go

31 lines
736 B
Go
Raw Normal View History

2012-03-27 23:13:14 +00:00
// 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.
package net
2017-04-10 11:32:00 +00:00
import (
"os"
"syscall"
)
2012-03-27 23:13:14 +00:00
func maxListenerBacklog() int {
// TODO: Implement this
2014-09-21 17:33:12 +00:00
// NOTE: Never return a number bigger than 1<<16 - 1. See issue 5030.
2012-03-27 23:13:14 +00:00
return syscall.SOMAXCONN
}
2017-04-10 11:32:00 +00:00
func sysSocket(family, sotype, proto int) (syscall.Handle, error) {
2014-09-21 17:33:12 +00:00
// See ../syscall/exec_unix.go for description of ForkLock.
syscall.ForkLock.RLock()
2017-04-10 11:32:00 +00:00
s, err := socketFunc(family, sotype, proto)
2014-09-21 17:33:12 +00:00
if err == nil {
syscall.CloseOnExec(s)
2012-03-27 23:13:14 +00:00
}
2014-09-21 17:33:12 +00:00
syscall.ForkLock.RUnlock()
2017-04-10 11:32:00 +00:00
if err != nil {
return syscall.InvalidHandle, os.NewSyscallError("socket", err)
}
return s, nil
2012-03-27 23:13:14 +00:00
}