From 19b814b80b7082f28dbd1f383ce9387407ffdf9f Mon Sep 17 00:00:00 2001 From: Ian Lance Taylor Date: Thu, 8 Jun 2023 17:21:56 -0700 Subject: [PATCH] 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 --- src/net/sock_cloexec.go | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) 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 -- 2.50.0