github.com/bananabytelabs/wazero@v0.0.0-20240105073314-54b22a776da8/internal/platform/mmap_other.go (about)

     1  // Separated from linux which has support for huge pages.
     2  //go:build darwin || freebsd
     3  
     4  package platform
     5  
     6  import "syscall"
     7  
     8  func mmapCodeSegment(size, prot int) ([]byte, error) {
     9  	return syscall.Mmap(
    10  		-1,
    11  		0,
    12  		size,
    13  		prot,
    14  		// Anonymous as this is not an actual file, but a memory,
    15  		// Private as this is in-process memory region.
    16  		syscall.MAP_ANON|syscall.MAP_PRIVATE,
    17  	)
    18  }