Debian Codegraph @

libgo/go/syscall/mmap_unix_test.go

raw
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 //go:build aix || darwin || dragonfly || freebsd || hurd || linux || netbsd || openbsd
6
7 package syscall_test
8
9 import (
10 "syscall"
11 "testing"
12 )
13
14 func TestMmap(t *testing.T) {
15 b, err := syscall.Mmap(-1, 0, syscall.Getpagesize(), syscall.PROT_NONE, syscall.MAP_ANON|syscall.MAP_PRIVATE)
16 if err != nil {
17 t.Fatalf("Mmap: %v", err)
18 }
19 if err := syscall.Munmap(b); err != nil {
20 t.Fatalf("Munmap: %v", err)
21 }
22 }