mirror of
https://github.com/golang/go
synced 2024-11-23 04:00:03 -07:00
net: update SOCK_CLOEXEC comment
For #45964 For #59359 Change-Id: I7fd295a096e5776102e057789d157da681df9073 Reviewed-on: https://go-review.googlesource.com/c/go/+/501939 TryBot-Result: Gopher Robot <gobot@golang.org> Reviewed-by: Bryan Mills <bcmills@google.com> Auto-Submit: Ian Lance Taylor <iant@google.com> Run-TryBot: Ian Lance Taylor <iant@google.com> Run-TryBot: Ian Lance Taylor <iant@golang.org> Reviewed-by: Ian Lance Taylor <iant@google.com>
This commit is contained in:
parent
bd00528d04
commit
19b814b80b
@ -19,11 +19,9 @@ import (
|
||||
// descriptor as nonblocking and close-on-exec.
|
||||
func sysSocket(family, sotype, proto int) (int, error) {
|
||||
s, err := socketFunc(family, sotype|syscall.SOCK_NONBLOCK|syscall.SOCK_CLOEXEC, proto)
|
||||
// On Linux the SOCK_NONBLOCK and SOCK_CLOEXEC flags were
|
||||
// introduced in 2.6.27 kernel and on FreeBSD both flags were
|
||||
// introduced in 10 kernel. If we get an EINVAL error on Linux
|
||||
// or EPROTONOSUPPORT error on FreeBSD, fall back to using
|
||||
// socket without them.
|
||||
// TODO: We can remove the fallback on Linux and *BSD,
|
||||
// as currently supported versions all support accept4
|
||||
// with SOCK_CLOEXEC, but Solaris does not. See issue #59359.
|
||||
switch err {
|
||||
case nil:
|
||||
return s, nil
|
||||
|
Loading…
Reference in New Issue
Block a user