github.com/choleraehyq/piD@v0.0.11/runtime_go1.5.go (about) 1 // Copyright 2016 Peter Mattis. 2 // 3 // Licensed under the Apache License, Version 2.0 (the "License"); 4 // you may not use this file except in compliance with the License. 5 // You may obtain a copy of the License at 6 // 7 // http://www.apache.org/licenses/LICENSE-2.0 8 // 9 // Unless required by applicable law or agreed to in writing, software 10 // distributed under the License is distributed on an "AS IS" BASIS, 11 // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or 12 // implied. See the License for the specific language governing 13 // permissions and limitations under the License. See the AUTHORS file 14 // for names of contributors. 15 16 // +build go1.5,!go1.6 17 18 package goid 19 20 // Just enough of the structs from runtime/runtime2.go to get the offset to goid. 21 // See https://github.com/golang/go/blob/release-branch.go1.5/src/runtime/runtime2.go 22 23 type stack struct { 24 lo uintptr 25 hi uintptr 26 } 27 28 type gobuf struct { 29 sp uintptr 30 pc uintptr 31 g uintptr 32 ctxt uintptr 33 ret uintptr 34 lr uintptr 35 bp uintptr 36 } 37 38 type g struct { 39 stack stack 40 stackguard0 uintptr 41 stackguard1 uintptr 42 43 _panic uintptr 44 _defer uintptr 45 m uintptr 46 stackAlloc uintptr 47 sched gobuf 48 syscallsp uintptr 49 syscallpc uintptr 50 stkbar []uintptr 51 stkbarPos uintptr 52 param uintptr 53 atomicstatus uint32 54 stackLock uint32 55 goid int64 // Here it is! 56 }