mmap_unix_test.go 571 B

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