mirror of
https://github.com/golang/go
synced 2024-11-25 22:28:02 -07:00
cabf9fe4f2
aix supports iovec read/write, see https://www.ibm.com/docs/en/aix/7.2?topic=w-write-writex-write64x-writev-writevx-ewrite-ewritev-pwrite-pwritev-subroutine Define an unexported writev wrapper in package syscall (like on openbsd and darwin) and linkname it from internal/poll. Change-Id: I8f9695ceac72ae861afa3692207c154d86d4e690 Reviewed-on: https://go-review.googlesource.com/c/go/+/435260 Run-TryBot: Tobias Klauser <tobias.klauser@gmail.com> Reviewed-by: Carlos Amedee <carlos@golang.org> Reviewed-by: Ian Lance Taylor <iant@google.com> TryBot-Result: Gopher Robot <gobot@golang.org> Auto-Submit: Tobias Klauser <tobias.klauser@gmail.com>
30 lines
666 B
Go
30 lines
666 B
Go
// Copyright 2016 The Go Authors. All rights reserved.
|
|
// Use of this source code is governed by a BSD-style
|
|
// license that can be found in the LICENSE file.
|
|
|
|
//go:build unix
|
|
|
|
package net
|
|
|
|
import (
|
|
"runtime"
|
|
"syscall"
|
|
)
|
|
|
|
func (c *conn) writeBuffers(v *Buffers) (int64, error) {
|
|
if !c.ok() {
|
|
return 0, syscall.EINVAL
|
|
}
|
|
n, err := c.fd.writeBuffers(v)
|
|
if err != nil {
|
|
return n, &OpError{Op: "writev", Net: c.fd.net, Source: c.fd.laddr, Addr: c.fd.raddr, Err: err}
|
|
}
|
|
return n, nil
|
|
}
|
|
|
|
func (fd *netFD) writeBuffers(v *Buffers) (n int64, err error) {
|
|
n, err = fd.pfd.Writev((*[][]byte)(v))
|
|
runtime.KeepAlive(fd)
|
|
return n, wrapSyscallError("writev", err)
|
|
}
|