diff options
Diffstat (limited to 'src/net/writev_unix.go')
-rw-r--r-- | src/net/writev_unix.go | 29 |
1 files changed, 29 insertions, 0 deletions
diff --git a/src/net/writev_unix.go b/src/net/writev_unix.go new file mode 100644 index 0000000..8b20f42 --- /dev/null +++ b/src/net/writev_unix.go @@ -0,0 +1,29 @@ +// 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. + +// +build darwin dragonfly freebsd illumos linux netbsd openbsd + +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) +} |