git.sr.ht/~pingoo/stdx@v0.0.0-20240218134121-094174641f6e/mmdb/mmap_unix.go (about)

     1  //go:build !windows && !appengine && !plan9 && !js && !wasip1
     2  // +build !windows,!appengine,!plan9,!js,!wasip1
     3  
     4  package mmdb
     5  
     6  import (
     7  	"golang.org/x/sys/unix"
     8  )
     9  
    10  func mmap(fd, length int) (data []byte, err error) {
    11  	return unix.Mmap(fd, 0, length, unix.PROT_READ, unix.MAP_SHARED)
    12  }
    13  
    14  func munmap(b []byte) (err error) {
    15  	return unix.Munmap(b)
    16  }