Black Lives Matter. Support the Equal Justice Initiative.

Source file src/syscall/mmap_unix_test.go

Documentation: syscall

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

View as plain text