unix: add readv/writev for illumos

iovec read/writes (readv, writev, preadv, pwritev) are present on
illumos, but they weren't added to the package. This commit adds
those missing features.

Updates golang/go#36201

Change-Id: Iecf2bab7ef846f5ca5d693e833491d819618c15d
GitHub-Last-Rev: 81a479f4c5f851f81e748cef6eb529c3f89cd1e1
GitHub-Pull-Request: golang/sys#64
Reviewed-on: https://go-review.googlesource.com/c/sys/+/224238
Run-TryBot: Tobias Klauser <tobias.klauser@gmail.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Tobias Klauser <tobias.klauser@gmail.com>
This commit is contained in:
Araragi Hokuto
2020-03-21 13:42:03 +00:00
committed by Tobias Klauser
parent af34d8274f
commit 328b4cd54a
4 changed files with 168 additions and 7 deletions
+13 -7
View File
@@ -32,9 +32,10 @@ import (
)
var (
b32 = flag.Bool("b32", false, "32bit big-endian")
l32 = flag.Bool("l32", false, "32bit little-endian")
tags = flag.String("tags", "", "build tags")
b32 = flag.Bool("b32", false, "32bit big-endian")
l32 = flag.Bool("l32", false, "32bit little-endian")
tags = flag.String("tags", "", "build tags")
illumos = flag.Bool("illumos", false, "illumos specific code generation")
)
// cmdLine returns this programs's commandline arguments
@@ -306,11 +307,16 @@ func main() {
imp := ""
if pack != "unix" {
imp = "import \"golang.org/x/sys/unix\"\n"
}
syscallimp := ""
if !*illumos {
syscallimp = "\"syscall\""
}
vardecls := "\t" + strings.Join(vars, ",\n\t")
vardecls += " syscallFunc"
fmt.Printf(srcTemplate, cmdLine(), buildTags(), pack, imp, dynimports, linknames, vardecls, text)
fmt.Printf(srcTemplate, cmdLine(), buildTags(), pack, syscallimp, imp, dynimports, linknames, vardecls, text)
}
const srcTemplate = `// %s
@@ -321,8 +327,8 @@ const srcTemplate = `// %s
package %s
import (
"syscall"
"unsafe"
"unsafe"
%s
)
%s
%s