mirror of
https://github.com/rwinkhart/sys.git
synced 2026-09-05 08:37:31 -04:00
unix: update z/OS implementation of fcntl and mmap
- Add a wrapper function around fcntl to handle different operation types and new fcntl implementation that accepts uintptr as an arg. - Add support for calling mmap/munmap with address pointers. - Add accompanying tests for new functions. Change-Id: If5e77aa4cf2cccfd431de4f3bd0c5014a761e167 GitHub-Last-Rev: 07e32a4ab797c7baffdb50f8407cf679cabf1dae GitHub-Pull-Request: golang/sys#216 Reviewed-on: https://go-review.googlesource.com/c/sys/+/610296 Reviewed-by: Ian Lance Taylor <iant@google.com> Reviewed-by: Dmitri Shuralyov <dmitshur@google.com> Auto-Submit: Dmitri Shuralyov <dmitshur@golang.org> TryBot-Bypass: Dmitri Shuralyov <dmitshur@golang.org>
This commit is contained in:
@@ -72,3 +72,17 @@ func TestMmap(t *testing.T) {
|
||||
t.Fatalf("Munmap: %v", err)
|
||||
}
|
||||
}
|
||||
|
||||
func TestMmapPtr(t *testing.T) {
|
||||
p, err := unix.MmapPtr(-1, 0, nil, uintptr(2*unix.Getpagesize()),
|
||||
unix.PROT_READ|unix.PROT_WRITE, unix.MAP_ANON|unix.MAP_PRIVATE)
|
||||
if err != nil {
|
||||
t.Fatalf("MmapPtr: %v", err)
|
||||
}
|
||||
|
||||
*(*byte)(p) = 42
|
||||
|
||||
if err := unix.MunmapPtr(p, uintptr(2*unix.Getpagesize())); err != nil {
|
||||
t.Fatalf("MunmapPtr: %v", err)
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user