From 317c0324c9c73e1c6d6c9cfa7e9cdbfbf1f63b06 Mon Sep 17 00:00:00 2001 From: Googler Date: Sun, 24 Feb 2019 17:30:53 -0800 Subject: [PATCH] Internal change. PiperOrigin-RevId: 235447861 Change-Id: Ic6ba5e0ed89f1b85651da084be70ef8d0ffc13cf --- pkg/unet/unet_unsafe.go | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/pkg/unet/unet_unsafe.go b/pkg/unet/unet_unsafe.go index 1d69de542..1d6ec286c 100644 --- a/pkg/unet/unet_unsafe.go +++ b/pkg/unet/unet_unsafe.go @@ -87,7 +87,9 @@ func buildIovec(bufs [][]byte, iovecs []syscall.Iovec) ([]syscall.Iovec, int) { return iovecs, length } -// ReadVec implements vecio.Reader.ReadVec. +// ReadVec reads into the pre-allocated bufs. Returns bytes read. +// +// The pre-allocatted space used by ReadVec is based upon slice lengths. // // This function is not guaranteed to read all available data, it // returns as soon as a single recvmsg call succeeds. @@ -160,7 +162,7 @@ func (r *SocketReader) ReadVec(bufs [][]byte) (int, error) { } // All unet sockets are SOCK_STREAM or SOCK_SEQPACKET, both of which - // indicate that the other end is closed by returning a 0-length read + // indicate that the other end is closed by returning a 0 length read // with no error. if n == 0 { return 0, io.EOF @@ -178,7 +180,7 @@ func (r *SocketReader) ReadVec(bufs [][]byte) (int, error) { return int(n), nil } -// WriteVec implements vecio.Writer.WriteVec. +// WriteVec writes the bufs to the socket. Returns bytes written. // // This function is not guaranteed to send all data, it returns // as soon as a single sendmsg call succeeds.