Skip to content

Commit 98277f3

Browse files
tklausergopherbot
authored andcommitted
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 <[email protected]> TryBot-Result: Gopher Robot <[email protected]> Auto-Submit: Tobias Klauser <[email protected]> Reviewed-by: Than McIntosh <[email protected]> Reviewed-by: Bryan Mills <[email protected]>
1 parent dcf3545 commit 98277f3

File tree

2 files changed

+15
-1
lines changed

2 files changed

+15
-1
lines changed

src/syscall/mmap_unix_test.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
// Use of this source code is governed by a BSD-style
33
// license that can be found in the LICENSE file.
44

5-
//go:build aix || darwin || dragonfly || freebsd || linux || netbsd || openbsd
5+
//go:build aix || darwin || dragonfly || freebsd || linux || netbsd || openbsd || solaris
66

77
package syscall_test
88

src/syscall/syscall_solaris.go

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -536,6 +536,20 @@ func writelen(fd int, buf *byte, nbuf int) (n int, err error) {
536536
return
537537
}
538538

539+
var mapper = &mmapper{
540+
active: make(map[*byte][]byte),
541+
mmap: mmap,
542+
munmap: munmap,
543+
}
544+
545+
func Mmap(fd int, offset int64, length int, prot int, flags int) (data []byte, err error) {
546+
return mapper.Mmap(fd, offset, length, prot, flags)
547+
}
548+
549+
func Munmap(b []byte) (err error) {
550+
return mapper.Munmap(b)
551+
}
552+
539553
func Utimes(path string, tv []Timeval) error {
540554
if len(tv) != 2 {
541555
return EINVAL

0 commit comments

Comments
 (0)