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