Implement getpagesize and munmap. For go 1.18.

This commit is contained in:
Dan Kegel
2022-03-17 09:53:28 -07:00
committed by Ron Evans
parent 06b19cde2d
commit cf8f4d65f2
2 changed files with 43 additions and 0 deletions
+23
View File
@@ -0,0 +1,23 @@
// Copyright 2014 The Go Authors. All rights reserved.
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.
//go:build darwin || linux
// +build darwin linux
package syscall_test
import (
"syscall"
"testing"
)
func TestMmap(t *testing.T) {
b, err := syscall.Mmap(-1, 0, syscall.Getpagesize(), syscall.PROT_NONE, syscall.MAP_ANON|syscall.MAP_PRIVATE)
if err != nil {
t.Fatalf("Mmap: %v", err)
}
if err := syscall.Munmap(b); err != nil {
t.Fatalf("Munmap: %v", err)
}
}