mmap_other.go
1// Separated from linux which has support for huge pages.
2//go:build darwin || freebsd || netbsd || dragonfly || solaris
3
4package platform
5
6import "syscall"
7
8func 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}