github.com/juelite/golang.org-x-sys@v0.0.0-20181121071242-7b69e1c5db33/unix/mmap_unix_test.go (about) 1 // Copyright 2014 The Go Authors. All rights reserved. 2 // Use of this source code is governed by a BSD-style 3 // license that can be found in the LICENSE file. 4 5 // +build darwin dragonfly freebsd linux netbsd openbsd solaris 6 7 package unix_test 8 9 import ( 10 "testing" 11 12 "golang.org/x/sys/unix" 13 ) 14 15 func TestMmap(t *testing.T) { 16 b, err := unix.Mmap(-1, 0, unix.Getpagesize(), unix.PROT_NONE, unix.MAP_ANON|unix.MAP_PRIVATE) 17 if err != nil { 18 t.Fatalf("Mmap: %v", err) 19 } 20 if err := unix.Munmap(b); err != nil { 21 t.Fatalf("Munmap: %v", err) 22 } 23 }