procalive

package
v0.214.0 Latest Latest
Warning

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

Go to latest
Published: Nov 29, 2026 License: Apache-2.0 Imports: 5 Imported by: 0 modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

Documentation

Index

Constants

This section is empty.

Variables

View Source
var ReadProcStat = defaultReadProcStat

ReadProcStat reads /proc/<pid>/stat for pid on Linux. Tests may replace it to simulate zombie or dead processes without spawning one.

Functions

func Alive

func Alive(pid int) bool

Alive reports whether pid refers to a process that is live or cannot be proved absent. Only non-positive PIDs, ESRCH, and Linux zombie/dead states (Z/X) report false; EPERM and other probe errors report true.

func Probe

func Probe(pid int) error

Probe checks whether pid refers to a live process on Unix.

It returns syscall.ESRCH when pid <= 0, when kill(pid, 0) returns ESRCH, or when /proc/<pid>/stat reports state Z (zombie) or X (dead). Otherwise it returns the kill(pid, 0) result (nil when alive, syscall.EPERM when owned by another user, or any other kernel error). If /proc/<pid>/stat is unreadable or unparseable, Probe falls back to the kill(pid, 0) result.

Types

This section is empty.

Jump to

Keyboard shortcuts

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