proc

package
v1.26.0 Latest Latest
Warning

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

Go to latest
Published: Nov 19, 2024 License: Apache-2.0 Imports: 17 Imported by: 0

Documentation

Index

Constants

View Source
const Path = "/proc"

Path to proc filesystem.

Variables

View Source
var (
	ErrCannotGetPIDNSInode            = errors.New("cannot get pidns inode")
	ErrParseStatFileInvalidCommFormat = errors.New("cannot parse stat file, invalid comm format")
	ErrParseStatFileNotEnoughFields   = errors.New("cannot parse stat file, not enough fields")
	ErrNoCgroupPathFound              = errors.New("no cgroup path found")
)

Functions

func HostPath added in v1.7.0

func HostPath(p string) string

HostPath returns full file path on the host file system using procfs, eg: /proc/1/root/<my-path>

func LoadSymbolAddresses added in v1.22.0

func LoadSymbolAddresses(symbols map[string]uint64) error

Types

type NamespaceID

type NamespaceID = uint64

type NamespaceType

type NamespaceType string
const (
	PIDNamespace   NamespaceType = "pid"
	MountNamespace NamespaceType = "mnt"
)

type PID

type PID = uint32

type Proc

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

func New

func New() *Proc

func NewFromFS added in v1.15.0

func NewFromFS(fs ProcFS) *Proc

func (*Proc) FindCGroupPathForPID added in v1.15.0

func (p *Proc) FindCGroupPathForPID(pid PID) (string, error)

func (*Proc) GetCurrentPIDNSID

func (p *Proc) GetCurrentPIDNSID() (NamespaceID, error)

func (*Proc) GetNSForPID

func (p *Proc) GetNSForPID(pid PID, ns NamespaceType) (NamespaceID, error)

func (*Proc) GetProcessStartTime

func (p *Proc) GetProcessStartTime(pid PID) (uint64, error)

GetProcessStartTime parses the /proc/<pid>/stat file to determine the start time of the process after system boot.

func (*Proc) LoadMountNSOldestProcesses

func (p *Proc) LoadMountNSOldestProcesses() (map[NamespaceID]PID, error)

func (*Proc) SnapshotProcessTree added in v1.15.0

func (p *Proc) SnapshotProcessTree(targetPID PID) ([]Process, error)

SnapshotProcessTree records a snappshot of the current process tree in the PID namespace of the given targetPID. This is done by iterating over files exposed from the `/proc` filesystem.

type ProcFS

type ProcFS interface {
	fs.ReadDirFS
	fs.ReadFileFS
	fs.StatFS
}

func GetFS

func GetFS() ProcFS

type Process added in v1.15.0

type Process struct {
	PID  PID
	PPID PID
	Args []string
	// StartTime since boot start
	StartTime time.Duration
	FilePath  string
}

Jump to

Keyboard shortcuts

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