mirror of https://github.com/golang/go.git
internal/poll, internal/syscall/unix, net: enable writev on solaris
The writev syscall is available since at least Solaris 11.3. Reuse the existing illumos writev wrapper on solaris to implement internal/poll.writev for net.(*netFD).writeBuffers. Change-Id: I23adc3bb4637740c72bfb61bfa9697b432dfe3db Reviewed-on: https://go-review.googlesource.com/c/go/+/427714 Run-TryBot: Tobias Klauser <tobias.klauser@gmail.com> TryBot-Result: Gopher Robot <gobot@golang.org> Reviewed-by: Ian Lance Taylor <iant@google.com> Reviewed-by: Michael Knyszek <mknyszek@google.com>
This commit is contained in:
parent
e0e0c8fe98
commit
00234b052e
|
|
@ -2,8 +2,6 @@
|
|||
// Use of this source code is governed by a BSD-style
|
||||
// license that can be found in the LICENSE file.
|
||||
|
||||
//go:build illumos
|
||||
|
||||
package poll
|
||||
|
||||
import (
|
||||
|
|
@ -2,8 +2,6 @@
|
|||
// Use of this source code is governed by a BSD-style
|
||||
// license that can be found in the LICENSE file.
|
||||
|
||||
//go:build illumos
|
||||
|
||||
package poll
|
||||
|
||||
import (
|
||||
|
|
@ -2,12 +2,13 @@
|
|||
// Use of this source code is governed by a BSD-style
|
||||
// license that can be found in the LICENSE file.
|
||||
|
||||
//go:build darwin || dragonfly || freebsd || illumos || linux || netbsd || openbsd
|
||||
//go:build darwin || dragonfly || freebsd || linux || netbsd || openbsd || solaris
|
||||
|
||||
package poll
|
||||
|
||||
import (
|
||||
"io"
|
||||
"runtime"
|
||||
"syscall"
|
||||
)
|
||||
|
||||
|
|
@ -29,6 +30,10 @@ func (fd *FD) Writev(v *[][]byte) (int64, error) {
|
|||
// 1024 and this seems conservative enough for now. Darwin's
|
||||
// UIO_MAXIOV also seems to be 1024.
|
||||
maxVec := 1024
|
||||
if runtime.GOOS == "solaris" {
|
||||
// IOV_MAX is set to XOPEN_IOV_MAX on Solaris.
|
||||
maxVec = 16
|
||||
}
|
||||
|
||||
var n int64
|
||||
var err error
|
||||
|
|
|
|||
|
|
@ -2,8 +2,6 @@
|
|||
// Use of this source code is governed by a BSD-style
|
||||
// license that can be found in the LICENSE file.
|
||||
|
||||
//go:build illumos
|
||||
|
||||
package unix
|
||||
|
||||
import (
|
||||
|
|
@ -153,7 +153,7 @@ func testBuffer_writeTo(t *testing.T, chunks int, useCopy bool) {
|
|||
|
||||
var wantSum int
|
||||
switch runtime.GOOS {
|
||||
case "android", "darwin", "ios", "dragonfly", "freebsd", "illumos", "linux", "netbsd", "openbsd":
|
||||
case "android", "darwin", "ios", "dragonfly", "freebsd", "illumos", "linux", "netbsd", "openbsd", "solaris":
|
||||
var wantMinCalls int
|
||||
wantSum = want.Len()
|
||||
v := chunks
|
||||
|
|
|
|||
|
|
@ -2,7 +2,7 @@
|
|||
// Use of this source code is governed by a BSD-style
|
||||
// license that can be found in the LICENSE file.
|
||||
|
||||
//go:build darwin || dragonfly || freebsd || illumos || linux || netbsd || openbsd
|
||||
//go:build darwin || dragonfly || freebsd || linux || netbsd || openbsd || solaris
|
||||
|
||||
package net
|
||||
|
||||
|
|
|
|||
Loading…
Reference in New Issue