aboutsummaryrefslogtreecommitdiff
path: root/src/syscall
diff options
context:
space:
mode:
authorTobias Klauser <tklauser@distanz.ch>2022-08-09 10:17:54 +0200
committerGopher Robot <gobot@golang.org>2022-08-09 12:06:56 +0000
commit98277f30e4365f3b35d856fa9cdee2fe01ab862b (patch)
treeda064f1b1f261f27500a7cb2d1b96005a60d64dc /src/syscall
parentdcf354512a25c1aea3d20efb7c8e3977e70479b6 (diff)
downloadgo-98277f30e4365f3b35d856fa9cdee2fe01ab862b.tar.xz
syscall: add Mmap and Munmap on solaris
They exist on all other Unix ports, define them on GOOS=solaris as well. Fixes #52875 Change-Id: I7285156b3b48ce12fbcc6d1d88865540a5c51a21 Reviewed-on: https://go-review.googlesource.com/c/go/+/413374 Run-TryBot: Tobias Klauser <tobias.klauser@gmail.com> TryBot-Result: Gopher Robot <gobot@golang.org> Auto-Submit: Tobias Klauser <tobias.klauser@gmail.com> Reviewed-by: Than McIntosh <thanm@google.com> Reviewed-by: Bryan Mills <bcmills@google.com>
Diffstat (limited to 'src/syscall')
-rw-r--r--src/syscall/mmap_unix_test.go2
-rw-r--r--src/syscall/syscall_solaris.go14
2 files changed, 15 insertions, 1 deletions
diff --git a/src/syscall/mmap_unix_test.go b/src/syscall/mmap_unix_test.go
index 3e9c08d67d..5e08b20679 100644
--- a/src/syscall/mmap_unix_test.go
+++ b/src/syscall/mmap_unix_test.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 || dragonfly || freebsd || linux || netbsd || openbsd
+//go:build aix || darwin || dragonfly || freebsd || linux || netbsd || openbsd || solaris
package syscall_test
diff --git a/src/syscall/syscall_solaris.go b/src/syscall/syscall_solaris.go
index 0363597c9e..f6d7e46cd3 100644
--- a/src/syscall/syscall_solaris.go
+++ b/src/syscall/syscall_solaris.go
@@ -536,6 +536,20 @@ func writelen(fd int, buf *byte, nbuf int) (n int, err error) {
return
}
+var mapper = &mmapper{
+ active: make(map[*byte][]byte),
+ mmap: mmap,
+ munmap: munmap,
+}
+
+func Mmap(fd int, offset int64, length int, prot int, flags int) (data []byte, err error) {
+ return mapper.Mmap(fd, offset, length, prot, flags)
+}
+
+func Munmap(b []byte) (err error) {
+ return mapper.Munmap(b)
+}
+
func Utimes(path string, tv []Timeval) error {
if len(tv) != 2 {
return EINVAL