Source file src/net/writev_unix.go

     1  // Copyright 2016 The Go Authors. All rights reserved.
     2  // Use of this source code is governed by a BSD-style
     3  // license that can be found in the LICENSE file.
     4  
     5  //go:build unix
     6  
     7  package net
     8  
     9  import (
    10  	"runtime"
    11  	"syscall"
    12  )
    13  
    14  func (c *conn) writeBuffers(v *Buffers) (int64, error) {
    15  	if !c.ok() {
    16  		return 0, syscall.EINVAL
    17  	}
    18  	n, err := c.fd.writeBuffers(v)
    19  	if err != nil {
    20  		return n, &OpError{Op: "writev", Net: c.fd.net, Source: c.fd.laddr, Addr: c.fd.raddr, Err: err}
    21  	}
    22  	return n, nil
    23  }
    24  
    25  func (fd *netFD) writeBuffers(v *Buffers) (n int64, err error) {
    26  	n, err = fd.pfd.Writev((*[][]byte)(v))
    27  	runtime.KeepAlive(fd)
    28  	return n, wrapSyscallError("writev", err)
    29  }
    30  

View as plain text