Skip to content

Commit

Permalink
syscall: add Mmap and Munmap on solaris
Browse files Browse the repository at this point in the history
They exist on all other Unix ports, define them on GOOS=solaris as well.

Fixes golang#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]>
  • Loading branch information
tklauser authored and jproberts committed Aug 10, 2022
1 parent fd64c91 commit 527343f
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 1 deletion.
2 changes: 1 addition & 1 deletion src/syscall/mmap_unix_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down
14 changes: 14 additions & 0 deletions src/syscall/syscall_solaris.go
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down

0 comments on commit 527343f

Please sign in to comment.