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