]> Cypherpunks repositories - gostls13.git/commitdiff
net: update SOCK_CLOEXEC comment
authorIan Lance Taylor <iant@golang.org>
Fri, 9 Jun 2023 00:21:56 +0000 (17:21 -0700)
committerGopher Robot <gobot@golang.org>
Fri, 9 Jun 2023 04:04:07 +0000 (04:04 +0000)
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>
src/net/sock_cloexec.go

index f4c116502884b978aa59d5db59aa9d3a72c53e8e..9eeb89746b9ef1d3ef6ecd67e3bc95cd65c197c8 100644 (file)
@@ -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