runtime_go1.6.go 810 B

12345678910111213141516171819202122232425262728293031323334353637383940414243
  1. //go:build gc && go1.6 && !go1.9
  2. // +build gc,go1.6,!go1.9
  3. package goid
  4. // Just enough of the structs from runtime/runtime2.go to get the offset to goid.
  5. // See https://github.com/golang/go/blob/release-branch.go1.6/src/runtime/runtime2.go
  6. type stack struct {
  7. lo uintptr
  8. hi uintptr
  9. }
  10. type gobuf struct {
  11. sp uintptr
  12. pc uintptr
  13. g uintptr
  14. ctxt uintptr
  15. ret uintptr
  16. lr uintptr
  17. bp uintptr
  18. }
  19. type g struct {
  20. stack stack
  21. stackguard0 uintptr
  22. stackguard1 uintptr
  23. _panic uintptr
  24. _defer uintptr
  25. m uintptr
  26. stackAlloc uintptr
  27. sched gobuf
  28. syscallsp uintptr
  29. syscallpc uintptr
  30. stkbar []uintptr
  31. stkbarPos uintptr
  32. stktopsp uintptr
  33. param uintptr
  34. atomicstatus uint32
  35. stackLock uint32
  36. goid int64 // Here it is!
  37. }