From 1ee729c5912f69e91d43032bd99fd166c492c72e Mon Sep 17 00:00:00 2001 From: Ian Lance Taylor Date: Wed, 7 Jun 2023 11:26:40 -0700 Subject: [PATCH] internal/poll: update SOCK_CLOEXEC comment For #45964 For #59359 Change-Id: I9f8f4c17ccd9711f81d152953a5e6aea50c6a28f Reviewed-on: https://go-review.googlesource.com/c/go/+/501636 Run-TryBot: Ian Lance Taylor Reviewed-by: Bryan Mills Run-TryBot: Ian Lance Taylor Reviewed-by: Ian Lance Taylor TryBot-Result: Gopher Robot Auto-Submit: Ian Lance Taylor --- src/internal/poll/sock_cloexec.go | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/src/internal/poll/sock_cloexec.go b/src/internal/poll/sock_cloexec.go index cb40f47136..361c11bc57 100644 --- a/src/internal/poll/sock_cloexec.go +++ b/src/internal/poll/sock_cloexec.go @@ -15,10 +15,9 @@ import "syscall" // descriptor as nonblocking and close-on-exec. func accept(s int) (int, syscall.Sockaddr, string, error) { ns, sa, err := Accept4Func(s, syscall.SOCK_NONBLOCK|syscall.SOCK_CLOEXEC) - // On Linux the accept4 system call was introduced in 2.6.28 - // kernel and on FreeBSD it was introduced in 10 kernel. If we - // get an ENOSYS error on both Linux and FreeBSD, or EINVAL - // error on Linux, fall back to using accept. + // 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 ns, sa, "", nil -- 2.50.0