1// +build illumos 2 3package buf 4 5import "golang.org/x/sys/unix" 6 7type unixReader struct { 8 iovs [][]byte 9} 10 11func (r *unixReader) Init(bs []*Buffer) { 12 iovs := r.iovs 13 if iovs == nil { 14 iovs = make([][]byte, 0, len(bs)) 15 } 16 for _, b := range bs { 17 iovs = append(iovs, b.v) 18 } 19 r.iovs = iovs 20} 21 22func (r *unixReader) Read(fd uintptr) int32 { 23 n, e := unix.Readv(int(fd), r.iovs) 24 if e != nil { 25 return -1 26 } 27 return int32(n) 28} 29 30func (r *unixReader) Clear() { 31 r.iovs = r.iovs[:0] 32} 33 34func newMultiReader() multiReader { 35 return &unixReader{} 36} 37