// Copyright 2009 The Go Authors. All rights reserved.// Use of this source code is governed by a BSD-style// license that can be found in the LICENSE file.package runtimeimport ()//go:generate go run wincallback.go//go:generate go run mkduff.go//go:generate go run mkfastlog2table.go//go:generate go run mklockrank.go -o lockrank.govar ticks ticksTypetype ticksType struct { lock mutex val atomic.Int64}// Note: Called by runtime/pprof in addition to runtime code.func tickspersecond() int64 { := ticks.val.Load()if != 0 {return }lock(&ticks.lock) = ticks.val.Load()if == 0 { := nanotime() := cputicks()usleep(100 * 1000) := nanotime() := cputicks()if == { ++ } = ( - ) * 1000 * 1000 * 1000 / ( - )if == 0 { ++ }ticks.val.Store() }unlock(&ticks.lock)return}var envs []stringvar argslice []string//go:linkname syscall_runtime_envs syscall.runtime_envsfunc syscall_runtime_envs() []string { returnappend([]string{}, envs...) }//go:linkname syscall_Getpagesize syscall.Getpagesizefunc syscall_Getpagesize() int { returnint(physPageSize) }//go:linkname os_runtime_args os.runtime_argsfunc os_runtime_args() []string { returnappend([]string{}, argslice...) }//go:linkname syscall_Exit syscall.Exit//go:nosplitfunc syscall_Exit( int) {exit(int32())}var godebugDefault stringvar godebugUpdate atomic.Pointer[func(string, string)]var godebugEnv atomic.Pointer[string] // set by parsedebugvarsvar godebugNewIncNonDefault atomic.Pointer[func(string) func()]//go:linkname godebug_setUpdate internal/godebug.setUpdatefunc godebug_setUpdate( func(string, string)) { := new(func(string, string)) * = godebugUpdate.Store()godebugNotify(false)}//go:linkname godebug_setNewIncNonDefault internal/godebug.setNewIncNonDefaultfunc godebug_setNewIncNonDefault( func(string) func()) { := new(func(string) func()) * = godebugNewIncNonDefault.Store()}// A godebugInc provides access to internal/godebug's IncNonDefault function// for a given GODEBUG setting.// Calls before internal/godebug registers itself are dropped on the floor.type godebugInc struct { name string inc atomic.Pointer[func()]}func ( *godebugInc) () { := .inc.Load()if == nil { := godebugNewIncNonDefault.Load()if == nil {return }// If other goroutines are racing here, no big deal. One will win, // and all the inc functions will be using the same underlying // *godebug.Setting. = new(func()) * = (*)(.name) .inc.Store() } (*)()}func godebugNotify( bool) { := godebugUpdate.Load()varstringif := godebugEnv.Load(); != nil { = * }if {reparsedebugvars() }if != nil { (*)(godebugDefault, ) }}//go:linkname syscall_runtimeSetenv syscall.runtimeSetenvfunc syscall_runtimeSetenv(, string) {setenv_c(, )if == "GODEBUG" { := new(string) * = godebugEnv.Store()godebugNotify(true) }}//go:linkname syscall_runtimeUnsetenv syscall.runtimeUnsetenvfunc syscall_runtimeUnsetenv( string) {unsetenv_c()if == "GODEBUG" {godebugEnv.Store(nil)godebugNotify(true) }}// writeErrStr writes a string to descriptor 2.////go:nosplitfunc writeErrStr( string) {write(2, unsafe.Pointer(unsafe.StringData()), int32(len()))}// auxv is populated on relevant platforms but defined here for all platforms// so x/sys/cpu can assume the getAuxv symbol exists without keeping its list// of auxv-using GOOS build tags in sync.//// It contains an even number of elements, (tag, value) pairs.var auxv []uintptrfunc getAuxv() []uintptr { returnauxv } // accessed from x/sys/cpu; see issue 57336
The pages are generated with Goldsv0.6.7. (GOOS=linux GOARCH=amd64)
Golds is a Go 101 project developed by Tapir Liu.
PR and bug reports are welcome and can be submitted to the issue list.
Please follow @Go100and1 (reachable from the left QR code) to get the latest news of Golds.