]> Cypherpunks repositories - gostls13.git/commitdiff
syscall: add Mmap and Munmap on solaris
authorTobias Klauser <tklauser@distanz.ch>
Tue, 9 Aug 2022 08:17:54 +0000 (10:17 +0200)
committerGopher Robot <gobot@golang.org>
Tue, 9 Aug 2022 12:06:56 +0000 (12:06 +0000)
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>
src/syscall/mmap_unix_test.go
src/syscall/syscall_solaris.go

index 3e9c08d67d38fb6ffc11bd67e054991adb294641..5e08b20679313e4c2148052e704616553f7df10a 100644 (file)
@@ -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
 
index 0363597c9e45b1edaa12bbe0521f06efd03ba6aa..f6d7e46cd35842777e9b83e3b66d64eb4504ffcc 100644 (file)
@@ -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