mirror of
https://gitea.com/gitea/tea.git
synced 2024-11-25 12:01:36 +01:00
3c312cb409
* github.com/araddon/dateparse upgrade => v0.0.0-20200409225146-d820a6159ab1 * code.gitea.io/sdk/gitea upgrade => v0.11.3 * github.com/olekukonko/tablewriter upgrade => v0.0.4 * github.com/mattn/go-runewidth upgrade => v0.0.9 * github.com/stretchr/testify upgrade => v1.5.1 * github.com/davecgh/go-spew upgrade => v1.1.1 * github.com/urfave/cli/v2 upgrade => v2.2.0 Co-authored-by: 6543 <6543@obermui.de> Reviewed-on: https://gitea.com/gitea/tea/pulls/129 Reviewed-by: techknowlogick <techknowlogick@gitea.io> Reviewed-by: Lunny Xiao <xiaolunwen@gmail.com>
58 lines
1.4 KiB
Go
58 lines
1.4 KiB
Go
// Copyright 2009 The Go Authors. All rights reserved.
|
|
// Use of this source code is governed by a BSD-style
|
|
// license that can be found in the LICENSE file.
|
|
|
|
// illumos system calls not present on Solaris.
|
|
|
|
// +build amd64,illumos
|
|
|
|
package unix
|
|
|
|
import "unsafe"
|
|
|
|
func bytes2iovec(bs [][]byte) []Iovec {
|
|
iovecs := make([]Iovec, len(bs))
|
|
for i, b := range bs {
|
|
iovecs[i].SetLen(len(b))
|
|
if len(b) > 0 {
|
|
// somehow Iovec.Base on illumos is (*int8), not (*byte)
|
|
iovecs[i].Base = (*int8)(unsafe.Pointer(&b[0]))
|
|
} else {
|
|
iovecs[i].Base = (*int8)(unsafe.Pointer(&_zero))
|
|
}
|
|
}
|
|
return iovecs
|
|
}
|
|
|
|
//sys readv(fd int, iovs []Iovec) (n int, err error)
|
|
|
|
func Readv(fd int, iovs [][]byte) (n int, err error) {
|
|
iovecs := bytes2iovec(iovs)
|
|
n, err = readv(fd, iovecs)
|
|
return n, err
|
|
}
|
|
|
|
//sys preadv(fd int, iovs []Iovec, off int64) (n int, err error)
|
|
|
|
func Preadv(fd int, iovs [][]byte, off int64) (n int, err error) {
|
|
iovecs := bytes2iovec(iovs)
|
|
n, err = preadv(fd, iovecs, off)
|
|
return n, err
|
|
}
|
|
|
|
//sys writev(fd int, iovs []Iovec) (n int, err error)
|
|
|
|
func Writev(fd int, iovs [][]byte) (n int, err error) {
|
|
iovecs := bytes2iovec(iovs)
|
|
n, err = writev(fd, iovecs)
|
|
return n, err
|
|
}
|
|
|
|
//sys pwritev(fd int, iovs []Iovec, off int64) (n int, err error)
|
|
|
|
func Pwritev(fd int, iovs [][]byte, off int64) (n int, err error) {
|
|
iovecs := bytes2iovec(iovs)
|
|
n, err = pwritev(fd, iovecs, off)
|
|
return n, err
|
|
}
|