From 4be02d35435e49f564b2dd09414036ef053d467b Mon Sep 17 00:00:00 2001 From: Mackenzie Malainey Date: Tue, 5 Mar 2024 21:30:21 +0000 Subject: [PATCH] unix: expose mmap calls on z/OS The calls `Mmap` and `Munmap` were removed for z/OS. Syscall removed occurred in: 508397 This change exposes them in a z/OS specific file (to remove the accidental deletion of them in future refactors of the APIs for `unix-like` OSes). Change-Id: Ice0cabfb4547cab2ffa7130b7c26d9cc38233afe GitHub-Last-Rev: e7b4680e63a774209ae5e40765492858871fbe13 GitHub-Pull-Request: golang/sys#186 Reviewed-on: https://go-review.googlesource.com/c/sys/+/569359 LUCI-TryBot-Result: Go LUCI Reviewed-by: Ian Lance Taylor Auto-Submit: Ian Lance Taylor Reviewed-by: Michael Knyszek --- unix/mmap_nomremap.go | 2 +- unix/syscall_zos_s390x.go | 8 ++++++++ 2 files changed, 9 insertions(+), 1 deletion(-) diff --git a/unix/mmap_nomremap.go b/unix/mmap_nomremap.go index 4b68e5978..7f602ffd2 100644 --- a/unix/mmap_nomremap.go +++ b/unix/mmap_nomremap.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 || openbsd || solaris +//go:build aix || darwin || dragonfly || freebsd || openbsd || solaris || zos package unix diff --git a/unix/syscall_zos_s390x.go b/unix/syscall_zos_s390x.go index b473038c6..27c41b6f0 100644 --- a/unix/syscall_zos_s390x.go +++ b/unix/syscall_zos_s390x.go @@ -1520,6 +1520,14 @@ func (m *mmapper) Munmap(data []byte) (err error) { return nil } +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 Read(fd int, p []byte) (n int, err error) { n, err = read(fd, p) if raceenabled {