From: Ian Lance Taylor Date: Fri, 9 Jun 2023 00:21:56 +0000 (-0700) Subject: net: update SOCK_CLOEXEC comment X-Git-Tag: go1.21rc1~48 X-Git-Url: http://www.git.cypherpunks.su/?a=commitdiff_plain;h=19b814b80b7082f28dbd1f383ce9387407ffdf9f;p=gostls13.git 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 Reviewed-by: Bryan Mills Auto-Submit: Ian Lance Taylor Run-TryBot: Ian Lance Taylor Run-TryBot: Ian Lance Taylor Reviewed-by: Ian Lance Taylor --- diff --git a/src/net/sock_cloexec.go b/src/net/sock_cloexec.go index f4c1165028..9eeb89746b 100644 --- a/src/net/sock_cloexec.go +++ b/src/net/sock_cloexec.go @@ -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