runtime

package
v0.0.0-...-b33dbb8 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Aug 31, 2026 License: MPL-2.0 Imports: 3 Imported by: 0

Documentation

Overview

Package runtime exposes a curated set of Go runtime internals (secure mode, traceback level, environment variables) that the intra core / tun2socks code needs to control on Android.

It is split out of intra/core into its own sub-package so that the //go:linkname directives below (which require the final link to be invoked with -checklinkname=0) only affect the final link of the tun2socks binary, not every other binary or test that imports intra/core transitively. Without this split, any package that transitively imports intra/core (which is most of the intra tree) would have to be built with -checklinkname=0 too.

Pushing / pulling runtime symbols via //go:linkname works provided the final link uses -ldflags="-checklinkname=0".

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func GetRuntimeEnviron

func GetRuntimeEnviron(key string) (val string, found bool)

GetRuntimeEnviron gets a value from the Go runtime's cached environment vars.

func RuntimeEnviron

func RuntimeEnviron() []string

RuntimeEnviron returns the Go runtime's cached environment vars. github.com/golang/go/blob/e2fef50def98/src/runtime/runtime1.go#L98

func RuntimeFinishDebugVarsSetup

func RuntimeFinishDebugVarsSetup()

RuntimeFinishDebugVarsSetup resets internal runtime debug variables by re-reading GODEBUG & GOTRACEBACK env vars. github.com/golang/go/blob/e2fef50def98/src/runtime/runtime1.go#L462

func RuntimeGotraceback

func RuntimeGotraceback() (l int32, all, crash bool)

RuntimeGotraceback returns the current GOTRACEBACK settings. github.com/golang/go/blob/e2fef50def98/src/runtime/runtime1.go#L38

func RuntimeResetTracebackEnv

func RuntimeResetTracebackEnv() (prev uint32)

traceback_env is the floor value that setTraceback ORs into every call: traceback_env = traceback_cache after finishDebugVarsSetup, so it encodes whatever level+crash bits were in force at that point. This makes traceback a one-way ratchet: once the level goes up (e.g. to "system"), t |= traceback_env prevents it from ever coming back down via a subsequent debug.SetTraceback("single") call. Zeroing it before setTraceback / finishDebugVarsSetup breaks the ratchet so the level can be raised or lowered freely. Must be called before RuntimeFinishDebugVarsSetup / debug.SetTraceback when a lower level than the previously-set one is desired. sample test: go.dev/play/p/VOPFogTh8Ny github.com/golang/go/blob/fed3b0a298/src/runtime/runtime1.go#L27

func RuntimeSecureMode

func RuntimeSecureMode() (them, us bool)

RuntimeSecureMode reports whether the Go runtime is in secure mode. github.com/golang/go/blob/e2fef50def98/src/runtime/os_linux.go#L296

func RuntimeWtf

func RuntimeWtf(s string)

RuntimeWtf uses runtime.writeHeader and emits s to logd. github.com/golang/go/blob/e2fef50def98/src/runtime/write_err_android.go#L39

func SecureMode

func SecureMode(new bool) (prev bool)

func SetRuntimeEnviron

func SetRuntimeEnviron(key, val string) (didSet, overwrote bool, err error)

SetRuntimeEnviron sets / adds a key-value pair in the Go runtime's cached environment vars.

Types

This section is empty.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL