github.com/choleraehyq/pid@v0.0.18/runtime_go1.6.go (about)

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