github.com/TeaOSLab/EdgeNode@v1.3.8/internal/utils/percpu/proc_id.go (about)

     1  // Copyright 2024 GoEdge CDN goedge.cdn@gmail.com. All rights reserved. Official site: https://goedge.cn .
     2  
     3  package percpu
     4  
     5  import (
     6  	_ "unsafe"
     7  )
     8  
     9  //go:linkname runtime_procPin runtime.procPin
    10  func runtime_procPin() int
    11  
    12  //go:linkname runtime_procUnpin runtime.procUnpin
    13  func runtime_procUnpin() int
    14  
    15  func GetProcId() int {
    16  	var pid = runtime_procPin()
    17  	runtime_procUnpin()
    18  	return pid
    19  }