runtime: remove fallback to pipe on platforms with pipe2

On Linux, the minimum required kernel version for Go 1.18 was be changed
to 2.6.32, see #45964. The pipe2 syscall was added in 2.6.27.

All other platforms already provide the pipe2 syscall in the minimum
supported version:
- DragonFly BSD added it in version 4.2, see
  https://www.dragonflybsd.org/release42/
- FreeBSD added it in version 10.0, see
  https://www.freebsd.org/cgi/man.cgi?pipe(2)#end
- NetBSD added it in version 6.0, see
  https://man.netbsd.org/pipe2.2#HISTORY
- OpenBSD added it in version 5.7, see
  https://man.openbsd.org/pipe.2#HISTORY
- Illumos supports it since 2013, see
  https://www.illumos.org/issues/3714
- Solaris supports it since 11.4

This also allows to remove setNonblock which was only used in the pipe
fallback path on these platforms.

Change-Id: I1f40d32fd3065d74e22af77b9ff2292b9cf66706
Reviewed-on: https://go-review.googlesource.com/c/go/+/389354
Trust: Tobias Klauser <tobias.klauser@gmail.com>
Run-TryBot: Tobias Klauser <tobias.klauser@gmail.com>
TryBot-Result: Gopher Robot <gobot@golang.org>
Reviewed-by: Ian Lance Taylor <iant@golang.org>
This commit is contained in:
Tobias Klauser 2022-03-03 10:19:07 +01:00 committed by Tobias Klauser
parent 58804ea67a
commit 9d34fc5108
64 changed files with 44 additions and 620 deletions

View file

@ -561,13 +561,6 @@ func write1(fd uintptr, buf unsafe.Pointer, nbyte int32) int32 {
return -int32(err)
}
//go:nosplit
func pipe() (r, w int32, errno int32) {
var p [2]int32
_, e := sysvicall1Err(&libc_pipe, uintptr(noescape(unsafe.Pointer(&p))))
return p[0], p[1], int32(e)
}
//go:nosplit
func pipe2(flags int32) (r, w int32, errno int32) {
var p [2]int32
@ -580,12 +573,6 @@ func closeonexec(fd int32) {
fcntl(fd, _F_SETFD, _FD_CLOEXEC)
}
//go:nosplit
func setNonblock(fd int32) {
flags := fcntl(fd, _F_GETFL, 0)
fcntl(fd, _F_SETFL, flags|_O_NONBLOCK)
}
func osyield1()
//go:nosplit