mirror of
https://github.com/golang/go
synced 2024-11-23 00:10:07 -07:00
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 <iant@google.com> Reviewed-by: Bryan Mills <bcmills@google.com> Run-TryBot: Ian Lance Taylor <iant@golang.org> Reviewed-by: Ian Lance Taylor <iant@google.com> TryBot-Result: Gopher Robot <gobot@golang.org> Auto-Submit: Ian Lance Taylor <iant@google.com>
This commit is contained in:
parent
7f26e9e5fb
commit
1ee729c591
@ -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
|
||||
|
Loading…
Reference in New Issue
Block a user