proc

package
v3.0.0-rc55 Latest Latest
Warning

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

Go to latest
Published: Oct 29, 2026 License: Apache-2.0 Imports: 10 Imported by: ? 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

This section is empty.

Functions

func Tree

func Tree(pid int) []int

Tree is pid and the ids of all its descendants, parents first, from one scan of /proc.

Types

type L

type L struct {
	// contains filtered or unexported fields
}

func All

func All() (L, error)

func ByCmdline

func ByCmdline(c []string) (L, error)

func NewList

func NewList() L

func (*L) Add

func (t *L) Add(proc T)

func (*L) AddPID

func (t *L) AddPID(pid int)

func (*L) FilterByEnv

func (t *L) FilterByEnv(key string, value string) L

func (*L) FilterByEnvList

func (t *L) FilterByEnvList(keys []string, value string) L

func (L) HasPID

func (t L) HasPID(pid int) bool

func (L) Len

func (t L) Len() int

func (L) Procs

func (t L) Procs() []T

func (L) String

func (t L) String() string

type T

type T struct {
	// contains filtered or unexported fields
}

func New

func New(pid int) T

func (T) CommandLine

func (t T) CommandLine() string

func (*T) Env

func (t *T) Env() map[string]string

func (T) Head

func (t T) Head() string

func (T) IsZombie

func (t T) IsZombie() (bool, error)

IsZombie says the process ended, its parent not having reaped it yet.

func (T) PID

func (t T) PID() int

func (T) PPID

func (t T) PPID() (int, error)

PPID is the id of the parent process, read from /proc/<pid>/stat.

func (T) Process

func (t T) Process() (*os.Process, error)

func (T) Signal

func (t T) Signal(sig os.Signal) error

func (T) SignalIf

func (t T) SignalIf(sig os.Signal, same func(T) bool) (bool, error)

SignalIf sends sig to the process when same, asked once the process is held, says it still is the one the caller found, and reports whether it sent it. On Linux the process is held by a pidfd, which the signal goes through: a pid the process left, and another process took, between the check and the signal is not signaled.

func (T) StartTime

func (t T) StartTime() (uint64, error)

StartTime is when the process started, in clock ticks since the boot, read from /proc/<pid>/stat. With the pid and the boot id, it names a process: a pid is reused, but not with the same start time before a reboot.

func (T) String

func (t T) String() string

Jump to

Keyboard shortcuts

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