Source file
src/runtime/set_vma_name_linux.go
1
2
3
4
5
6
7 package runtime
8
9 import (
10 "internal/runtime/atomic"
11 "internal/runtime/syscall"
12 "unsafe"
13 )
14
15 var prSetVMAUnsupported atomic.Bool
16
17
18 func setVMAName(start unsafe.Pointer, length uintptr, name string) {
19 if debug.decoratemappings == 0 || prSetVMAUnsupported.Load() {
20 return
21 }
22
23 var sysName [80]byte
24 n := copy(sysName[:], " Go: ")
25 copy(sysName[n:79], name)
26
27 _, _, err := syscall.Syscall6(syscall.SYS_PRCTL, syscall.PR_SET_VMA, syscall.PR_SET_VMA_ANON_NAME, uintptr(start), length, uintptr(unsafe.Pointer(&sysName[0])), 0)
28 if err == _EINVAL {
29 prSetVMAUnsupported.Store(true)
30 }
31
32 }
33
View as plain text