Documentation
¶
Overview ¶
Child process steps every part of icebath takes the same way: how a child is started and how its end is read
Index ¶
- Constants
- func Android() bool
- func CPUFeatures() []string
- func Command(pid int) string
- func Contained() bool
- func Environ(env map[string]string) []string
- func ExitCode(state *os.ProcessState) int
- func Fares(pid int, start int64) (runs, told bool)
- func Gone(pid int) bool
- func Helper(ctx context.Context, names []string, argv ...string) *exec.Cmd
- func HideWindow(*exec.Cmd)
- func Machine(names ...string) map[string]string
- func Main(program func())
- func Managers() []string
- func Retitle(t Title)
- func Running(pid int) bool
- func SameStart(recorded, current int64) bool
- func Shell() string
- func Standing(pid int) (bool, int64, bool)
- func StartTime(pid int) (int64, bool)
- func Sweep(grace time.Duration) int
- func Termux() bool
- func TermuxPrefix() string
- func Titled() (string, bool)
- func Unreaped(parent int) int
- func Vendor(id string) string
- func Zombie(pid int) bool
- type Battery
- type GPU
- type Installer
- type Memory
- type Reaping
- type Self
- type Title
Constants ¶
const ( BatteryGood = "good" BatteryWarn = "warn" BatteryBad = "bad" BatteryCritical = "critical" BatteryDim = "dim" )
Categories of a battery, alpha's, by which the status line colours it
const ( NVIDIA = "nvidia" AMD = "amd" Intel = "intel" Apple = "apple" Qualcomm = "qualcomm" )
Makers of graphics processors, as the PCI ids of their devices name them
Variables ¶
This section is empty.
Functions ¶
func Android ¶
func Android() bool
Whether this process runs on Android, a build for it or a shell of Termux
func CPUFeatures ¶
func CPUFeatures() []string
Vector and matrix instruction sets of this computer's processor that the builds of a program pick a variant of their code by, such as AVX2 or SVE, by the names their makers give them; the base ones every processor of its kind has left out
func Command ¶
Name of the program the process with the pid runs, as the system keeps it; empty when it can't be read
func Contained ¶
func Contained() bool
Whether this process runs in a container: a Docker or Podman marker file, a Kubernetes pod, a container runtime in the first process's control group or under the root mount. Looked at once, as where a process runs does not change while it runs
func ExitCode ¶
func ExitCode(state *os.ProcessState) int
Exit code of a finished process, the negated number of the signal that ended one a signal ended
func Fares ¶
Whether the process that had the pid when StartTime gave start for it still runs, and whether the system told: it does not while a process this one may not look at has the pid
func Gone ¶
Whether no process with the pid runs, signal zero asking without sending anything: one this process may not signal still runs
func Helper ¶
Helper program acting for no profile, such as one that lists processes: started with the variables of Machine alone and the names given, its console window hidden
func HideWindow ¶
Keeps a child from opening a console window of its own, which only Windows gives it
func Machine ¶
Environment of a helper program that acts for no profile and may see none of the user's variables, such as one that lists processes: the variables of this machine and the language settings of this process, and those named besides, each as this process has it
func Main ¶
func Main(program func())
Runs the program, keeping the first thread of the process apart for the processes orphaned below it: the first process of a container reaps them from its start, any other once Adopt made it their reaper. Returns once the program returned
func Managers ¶
func Managers() []string
Package managers of this system whose program is on the search path, the one that installs its programs first: pkg in Termux, Homebrew then MacPorts on macOS, winget, Scoop then Chocolatey on Windows, the distribution's own on Linux by what os-release says of it
func Retitle ¶
func Retitle(t Title)
Names the process by the system's own means for what it is, at start and again whenever that changes: Linux names the first thread of the process, which ps and top read, macOS the thread that asks, and Windows names a process only after its program file. Never fatal; whether the system took the name is kept for Titled
func Shell ¶
func Shell() string
The plain shell of the system that runs a command line: Termux's on Termux and Android's elsewhere on Android, which keeps no /bin, else /bin/sh. A program of Go starts others by the system call, never through the libc Termux preloads to send /bin/sh to its own
func Standing ¶
Whether the process runs and is no zombie, and its start time with whether that could be read, from one read of its stat file where this machine has one
func Sweep ¶
Ends the processes left once the program stopped what it owns: the first process of a container every other process in it at once, a subreaper each orphan it took up and each handed to it meanwhile. They are told to end, and to go on if stopped so they hear it, given the grace while what is handed over is reaped as it ends, then killed and given a second more. Answers how many were told to end; none for a process that takes up nothing
func Termux ¶
func Termux() bool
Whether this process runs in Termux, the Linux userland of Android: Termux names its version in TERMUX_VERSION and its folder in PREFIX
func TermuxPrefix ¶
func TermuxPrefix() string
Folder of Termux's programs, libraries and settings, PREFIX in its shells; empty outside Termux
func Unreaped ¶
How many processes whose parent is the one with the pid ended and wait for it to reap them
Types ¶
type Battery ¶
type Battery struct {
// Charge in percent, -1 when not known, as for a computer with none
Percent int
// The computer runs on the battery, unplugged from the wall
Draining bool
// The computer is plugged into the wall; neither this nor Draining when the system does not say
Plugged bool
// The battery is being charged now
Charging bool
// The system saves power, as Windows' battery saver, macOS's Low Power Mode or a low-power platform profile of Linux do
Saver bool
// How long the battery lasts at the rate it drains now, as the system reckons it; zero when it does not say or the battery does not drain
Left time.Duration
// Batteries it is made of, some laptops having two; zero when the system does not say
Cells int
}
The battery of this computer as the system tells it
func ReadBattery ¶
The battery of this computer as read within the last few seconds; false for a computer with none, or whose system does not tell, its charge then -1
type GPU ¶
type GPU struct {
// One of the makers above, empty when it is not known
Vendor string
Name string
// Its PCI device id as four lower case hex digits, empty when the system does not say
Device string
// Memory of its own in bytes and how much of it is free now, both zero when the system does not say; for one that shares the computer's
// memory, what of that memory it may use
Memory, Free int64
Shared bool
// Version of its driver, and for an NVIDIA one the newest CUDA its driver runs, such as 13.0; empty when not known
Driver, CUDA string
// The driver by name: the kernel's module on Linux, such as amdgpu, or the maker of the driver on Windows; empty when not known
Module string
// Share of the last moment it was busy, in percent, -1 when not known
Busy int
}
One graphics processor of this computer as its system and driver tell it
func ReadGPUs ¶
func ReadGPUs() []GPU
Graphics processors of this computer, discrete ones first and then by their memory, as read within the last few seconds: each from the system's own record of its devices, an NVIDIA one from its driver's nvidia-smi, which tells its free memory and the CUDA it runs, and the CUDA of the driver itself where nvidia-smi is not there to say. Empty when the computer has none or the system tells nothing of them
func (GPU) CUDAMajor ¶
Major version of the CUDA the driver runs, 0 when it runs none or is not known
func (GPU) DriverTitle ¶
The driver as a person reads it, its name before its version, such as nvidia 580.65.06; empty when neither is known
type Installer ¶
type Installer struct {
Manager, Package string
}
How a program of the system's own packages is installed on this computer: the package manager that installs it and the name of the package there
func Installs ¶
The first package manager of this system that has the package, under the name each manager gives it; false when none of them does
type Memory ¶
type Memory struct {
Total, Available int64
}
Memory of this computer as the system tells it, in bytes: in all, and free for new work
func ReadMemory ¶
Memory of this computer as /proc/meminfo tells it, the bound of each control group this process runs in lowering both where one is set; false where it can't be read
type Reaping ¶
type Reaping int
What this process does with the processes orphaned below it
const ( // Nothing: they go to the first process of the system or of the container, as for any program Unadopted Reaping = iota // This process is the first of its container, and every process orphaned in the container is handed to it First // This process made itself the reaper of its descendants, and those orphaned below it are handed to it Adopting )
type Self ¶
type Self struct {
// Memory resident now, the part of it no file backs, and the most that was ever resident
Resident, Anonymous, Peak int64
// Files, sockets and other handles open
Files int64
// Seconds of processor time it took, its own and the system's for it
User, System float64
}
What the system says of this process, in bytes and seconds; -1 for what it does not say here