github.com/choleraehyq/pid@v0.0.18/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 //go:build go1.5 && !go1.6 17 // +build go1.5,!go1.6 18 19 package goid 20 21 // Just enough of the structs from runtime/runtime2.go to get the offset to goid. 22 // See https://github.com/golang/go/blob/release-branch.go1.5/src/runtime/runtime2.go 23 24 type stack struct { 25 lo uintptr 26 hi uintptr 27 } 28 29 type gobuf struct { 30 sp uintptr 31 pc uintptr 32 g uintptr 33 ctxt uintptr 34 ret uintptr 35 lr uintptr 36 bp uintptr 37 } 38 39 type g struct { 40 stack stack 41 stackguard0 uintptr 42 stackguard1 uintptr 43 44 _panic uintptr 45 _defer uintptr 46 m uintptr 47 stackAlloc uintptr 48 sched gobuf 49 syscallsp uintptr 50 syscallpc uintptr 51 stkbar []uintptr 52 stkbarPos uintptr 53 param uintptr 54 atomicstatus uint32 55 stackLock uint32 56 goid int64 // Here it is! 57 }