mirror of
https://github.com/golang/go.git
synced 2025-11-08 04:31:01 +00:00
net, syscall: use accept4 and SOCK_CLOEXEC on Linux
R=golang-dev, bradfitz, mikioh.mikioh, dave, minux.ma CC=golang-dev https://golang.org/cl/7227043
This commit is contained in:
parent
b53e95ac2e
commit
31f58dce67
11 changed files with 179 additions and 17 deletions
|
|
@ -20,6 +20,10 @@ func newFileFD(f *os.File) (*netFD, error) {
|
|||
}
|
||||
syscall.CloseOnExec(fd)
|
||||
syscall.ForkLock.RUnlock()
|
||||
if err = syscall.SetNonblock(fd, true); err != nil {
|
||||
closesocket(fd)
|
||||
return nil, err
|
||||
}
|
||||
|
||||
sotype, err := syscall.GetsockoptInt(fd, syscall.SOL_SOCKET, syscall.SO_TYPE)
|
||||
if err != nil {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue