aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorTobias Klauser <tklauser@distanz.ch>2022-10-04 13:53:46 +0200
committerGopher Robot <gobot@golang.org>2022-10-07 16:48:38 +0000
commit5ca0cd3f1824f189b6c5edf59b669f22a393e2e1 (patch)
treefa7ef497ea57333ad40e938ffd4a4f0d41022b3e /src
parentcabf9fe4f2d7e5adfa7007e11f508b111d07a2f6 (diff)
downloadgo-5ca0cd3f1824f189b6c5edf59b669f22a393e2e1.tar.xz
internal/poll, internal/syscall/unix, syscall: move writev definition for solaris
Move the writev definition for solaris from package internal/syscall/unix to package syscall. This corresponds to where writev is defined on aix, darwin and openbsd as well and is go:linkname'ed from internal/poll. This also allows updating the generated wrappers more easily if needed. Change-Id: I671ed8232d25319f8e63f549f786d77a17602148 Reviewed-on: https://go-review.googlesource.com/c/go/+/436597 Run-TryBot: Tobias Klauser <tobias.klauser@gmail.com> TryBot-Result: Gopher Robot <gobot@golang.org> Reviewed-by: Carlos Amedee <carlos@golang.org> Reviewed-by: Ian Lance Taylor <iant@google.com> Auto-Submit: Tobias Klauser <tobias.klauser@gmail.com>
Diffstat (limited to 'src')
-rw-r--r--src/internal/poll/fd_writev_libc.go2
-rw-r--r--src/internal/poll/fd_writev_solaris.go14
-rw-r--r--src/internal/syscall/unix/writev_solaris.go28
-rw-r--r--src/syscall/syscall_solaris.go1
-rw-r--r--src/syscall/zsyscall_solaris_amd64.go18
5 files changed, 20 insertions, 43 deletions
diff --git a/src/internal/poll/fd_writev_libc.go b/src/internal/poll/fd_writev_libc.go
index 7d59e6b641..0a60473b3e 100644
--- a/src/internal/poll/fd_writev_libc.go
+++ b/src/internal/poll/fd_writev_libc.go
@@ -2,7 +2,7 @@
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.
-//go:build aix || darwin || (openbsd && !mips64)
+//go:build aix || darwin || (openbsd && !mips64) || solaris
package poll
diff --git a/src/internal/poll/fd_writev_solaris.go b/src/internal/poll/fd_writev_solaris.go
deleted file mode 100644
index d20f20114e..0000000000
--- a/src/internal/poll/fd_writev_solaris.go
+++ /dev/null
@@ -1,14 +0,0 @@
-// Copyright 2020 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.
-
-package poll
-
-import (
- "internal/syscall/unix"
- "syscall"
-)
-
-func writev(fd int, iovecs []syscall.Iovec) (uintptr, error) {
- return unix.Writev(fd, iovecs)
-}
diff --git a/src/internal/syscall/unix/writev_solaris.go b/src/internal/syscall/unix/writev_solaris.go
deleted file mode 100644
index d4895eef9e..0000000000
--- a/src/internal/syscall/unix/writev_solaris.go
+++ /dev/null
@@ -1,28 +0,0 @@
-// Copyright 2020 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.
-
-package unix
-
-import (
- "syscall"
- "unsafe"
-)
-
-//go:cgo_import_dynamic libc_writev writev "libc.so"
-
-//go:linkname procwritev libc_writev
-
-var procwritev uintptr
-
-func Writev(fd int, iovs []syscall.Iovec) (uintptr, error) {
- var p *syscall.Iovec
- if len(iovs) > 0 {
- p = &iovs[0]
- }
- n, _, errno := syscall6(uintptr(unsafe.Pointer(&procwritev)), 3, uintptr(fd), uintptr(unsafe.Pointer(p)), uintptr(len(iovs)), 0, 0, 0)
- if errno != 0 {
- return 0, errno
- }
- return n, nil
-}
diff --git a/src/syscall/syscall_solaris.go b/src/syscall/syscall_solaris.go
index fce0b058fc..2d042acdc9 100644
--- a/src/syscall/syscall_solaris.go
+++ b/src/syscall/syscall_solaris.go
@@ -495,6 +495,7 @@ func sendmsgN(fd int, p, oob []byte, ptr unsafe.Pointer, salen _Socklen, flags i
//sys socket(domain int, typ int, proto int) (fd int, err error) = libsocket.__xnet_socket
//sysnb socketpair(domain int, typ int, proto int, fd *[2]int32) (err error) = libsocket.__xnet_socketpair
//sys write(fd int, p []byte) (n int, err error)
+//sys writev(fd int, iovecs []Iovec) (n uintptr, err error)
//sys getsockopt(s int, level int, name int, val unsafe.Pointer, vallen *_Socklen) (err error) = libsocket.__xnet_getsockopt
//sysnb getpeername(fd int, rsa *RawSockaddrAny, addrlen *_Socklen) (err error) = libsocket.getpeername
//sys getsockname(fd int, rsa *RawSockaddrAny, addrlen *_Socklen) (err error) = libsocket.getsockname
diff --git a/src/syscall/zsyscall_solaris_amd64.go b/src/syscall/zsyscall_solaris_amd64.go
index a2bbeed844..19e5ec1fcd 100644
--- a/src/syscall/zsyscall_solaris_amd64.go
+++ b/src/syscall/zsyscall_solaris_amd64.go
@@ -85,6 +85,7 @@ import "unsafe"
//go:cgo_import_dynamic libc___xnet_socket __xnet_socket "libsocket.so"
//go:cgo_import_dynamic libc___xnet_socketpair __xnet_socketpair "libsocket.so"
//go:cgo_import_dynamic libc_write write "libc.so"
+//go:cgo_import_dynamic libc_writev writev "libc.so"
//go:cgo_import_dynamic libc___xnet_getsockopt __xnet_getsockopt "libsocket.so"
//go:cgo_import_dynamic libc_getpeername getpeername "libsocket.so"
//go:cgo_import_dynamic libc_getsockname getsockname "libsocket.so"
@@ -172,6 +173,7 @@ import "unsafe"
//go:linkname libc___xnet_socket libc___xnet_socket
//go:linkname libc___xnet_socketpair libc___xnet_socketpair
//go:linkname libc_write libc_write
+//go:linkname libc_writev libc_writev
//go:linkname libc___xnet_getsockopt libc___xnet_getsockopt
//go:linkname libc_getpeername libc_getpeername
//go:linkname libc_getsockname libc_getsockname
@@ -262,6 +264,7 @@ var (
libc___xnet_socket,
libc___xnet_socketpair,
libc_write,
+ libc_writev,
libc___xnet_getsockopt,
libc_getpeername,
libc_getsockname,
@@ -1209,6 +1212,21 @@ func write(fd int, p []byte) (n int, err error) {
// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT
+func writev(fd int, iovecs []Iovec) (n uintptr, err error) {
+ var _p0 *Iovec
+ if len(iovecs) > 0 {
+ _p0 = &iovecs[0]
+ }
+ r0, _, e1 := sysvicall6(uintptr(unsafe.Pointer(&libc_writev)), 3, uintptr(fd), uintptr(unsafe.Pointer(_p0)), uintptr(len(iovecs)), 0, 0, 0)
+ n = uintptr(r0)
+ if e1 != 0 {
+ err = errnoErr(e1)
+ }
+ return
+}
+
+// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT
+
func getsockopt(s int, level int, name int, val unsafe.Pointer, vallen *_Socklen) (err error) {
_, _, e1 := sysvicall6(uintptr(unsafe.Pointer(&libc___xnet_getsockopt)), 5, uintptr(s), uintptr(level), uintptr(name), uintptr(val), uintptr(unsafe.Pointer(vallen)), 0)
if e1 != 0 {