2017-12-29 11:38:00 +00:00
|
|
|
// +build go1.6,!go1.9
|
2017-04-05 14:34:41 +00:00
|
|
|
|
|
|
|
package goid
|
|
|
|
|
|
|
|
// Just enough of the structs from runtime/runtime2.go to get the offset to goid.
|
|
|
|
// See https://github.com/golang/go/blob/release-branch.go1.6/src/runtime/runtime2.go
|
|
|
|
|
|
|
|
type stack struct {
|
|
|
|
lo uintptr
|
|
|
|
hi uintptr
|
|
|
|
}
|
|
|
|
|
|
|
|
type gobuf struct {
|
|
|
|
sp uintptr
|
|
|
|
pc uintptr
|
|
|
|
g uintptr
|
|
|
|
ctxt uintptr
|
|
|
|
ret uintptr
|
|
|
|
lr uintptr
|
|
|
|
bp uintptr
|
|
|
|
}
|
|
|
|
|
|
|
|
type g struct {
|
|
|
|
stack stack
|
|
|
|
stackguard0 uintptr
|
|
|
|
stackguard1 uintptr
|
|
|
|
|
|
|
|
_panic uintptr
|
|
|
|
_defer uintptr
|
|
|
|
m uintptr
|
|
|
|
stackAlloc uintptr
|
|
|
|
sched gobuf
|
|
|
|
syscallsp uintptr
|
|
|
|
syscallpc uintptr
|
|
|
|
stkbar []uintptr
|
|
|
|
stkbarPos uintptr
|
|
|
|
stktopsp uintptr
|
2017-12-29 11:38:00 +00:00
|
|
|
param uintptr
|
2017-04-05 14:34:41 +00:00
|
|
|
atomicstatus uint32
|
|
|
|
stackLock uint32
|
|
|
|
goid int64 // Here it is!
|
|
|
|
}
|