mirror of https://github.com/v2ray/v2ray-core
Previously v2ray can not be built on illumos due to following reasons: 1. missing build tags in transport/internet/sockopt_other.go 2. many definitions in syscall does not exist on illumos This commit addresses these problems by adding missing build tags, and updates those missing syscall deps on illumos to use x/sys/unix.pull/2359/head
parent
b217cade28
commit
6673733da7
@ -0,0 +1,36 @@
|
||||
// +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{}
|
||||
}
|
Loading…
Reference in new issue