1 // Copyright 2009 The Go Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style
3 // license that can be found in the LICENSE file.
8 "runtime/internal/atomic"
12 //go:generate go run wincallback.go
13 //go:generate go run mkduff.go
14 //go:generate go run mkfastlog2table.go
15 //go:generate go run mklockrank.go -o lockrank.go
19 type ticksType struct {
24 // Note: Called by runtime/pprof in addition to runtime code.
25 func tickspersecond() int64 {
41 r = (c1 - c0) * 1000 * 1000 * 1000 / (t1 - t0)
54 //go:linkname syscall_runtime_envs syscall.runtime_envs
55 func syscall_runtime_envs() []string { return append([]string{}, envs...) }
57 //go:linkname syscall_Getpagesize syscall.Getpagesize
58 func syscall_Getpagesize() int { return int(physPageSize) }
60 //go:linkname os_runtime_args os.runtime_args
61 func os_runtime_args() []string { return append([]string{}, argslice...) }
63 //go:linkname syscall_Exit syscall.Exit
65 func syscall_Exit(code int) {
69 var godebugDefault string
70 var godebugUpdate atomic.Pointer[func(string, string)]
71 var godebugEnv atomic.Pointer[string] // set by parsedebugvars
73 //go:linkname godebug_setUpdate internal/godebug.setUpdate
74 func godebug_setUpdate(update func(string, string)) {
75 p := new(func(string, string))
77 godebugUpdate.Store(p)
81 func godebugNotify() {
82 if update := godebugUpdate.Load(); update != nil {
84 if p := godebugEnv.Load(); p != nil {
87 (*update)(godebugDefault, env)
91 //go:linkname syscall_runtimeSetenv syscall.runtimeSetenv
92 func syscall_runtimeSetenv(key, value string) {
102 //go:linkname syscall_runtimeUnsetenv syscall.runtimeUnsetenv
103 func syscall_runtimeUnsetenv(key string) {
105 if key == "GODEBUG" {
106 godebugEnv.Store(nil)
111 // writeErrStr writes a string to descriptor 2.
114 func writeErrStr(s string) {
115 write(2, unsafe.Pointer(unsafe.StringData(s)), int32(len(s)))