proc

package
v0.23.0-rc Latest Latest
Warning

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

Go to latest
Published: Jan 20, 2025 License: Apache-2.0 Imports: 8 Imported by: 0

Documentation

Index

Constants

View Source
const (
	StatNumFields = 52
)

Variables

This section is empty.

Functions

func GetAllBinaryProcs added in v0.11.0

func GetAllBinaryProcs() (map[string][]uint32, error)

GetProcNS returns the namespace ID of a given namespace and process. To do so, it requires access to the /proc file system of the host, and CAP_SYS_PTRACE capability.

func GetMountNSFirstProcesses

func GetMountNSFirstProcesses() (map[int]int, error)

GetMountNSFirstProcesses return mapping between mount NS to its first process (aka, the process with the oldest start time in the mount NS)

func GetProcBinary added in v0.11.0

func GetProcBinary(pid uint) (string, error)

GetProcNS returns the namespace ID of a given namespace and process. To do so, it requires access to the /proc file system of the host, and CAP_SYS_PTRACE capability.

func GetProcNS

func GetProcNS(pid uint, nsName string) (int, error)

GetProcNS returns the namespace ID of a given namespace and process. To do so, it requires access to the /proc file system of the host, and CAP_SYS_PTRACE capability.

func GetProcessStartTime

func GetProcessStartTime(pid uint) (int, error)

GetProcessStartTime return the start time of the process using the procfs

Types

type ProcNS

type ProcNS struct {
	Cgroup          int
	Ipc             int
	Mnt             int
	Net             int
	Pid             int
	PidForChildren  int
	Time            int
	TimeForChildren int
	User            int
	Uts             int
}

func GetAllProcNS added in v0.11.0

func GetAllProcNS(pid uint) (*ProcNS, error)

GetAllProcNS return all the namespaces of a given process. To do so, it requires access to the /proc file system of the host, and CAP_SYS_PTRACE capability.

type ProcStat added in v0.18.0

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

ProcStat represents the minimal required fields of the /proc stat file.

func NewProcStat added in v0.18.0

func NewProcStat(pid int) (*ProcStat, error)

NewProcStat reads the /proc/<pid>/stat file and parses it into a ProcStat struct.

func NewThreadProcStat added in v0.18.0

func NewThreadProcStat(pid, tid int) (*ProcStat, error)

NewThreadProcStat reads the /proc/<pid>/task/<tid>/stat file and parses it into a ProcStat struct.

func (*ProcStat) GetStartTime added in v0.23.0

func (s *ProcStat) GetStartTime() uint64

GetStartTime returns the time the process started after system boot (in clock ticks).

type ProcStatus added in v0.18.0

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

ProcStatus represents the minimal required fields of the /proc status file.

func NewProcStatus added in v0.18.0

func NewProcStatus(pid int) (*ProcStatus, error)

NewProcStatus reads the /proc/<pid>/status file and parses it into a ProcStatus struct.

func NewThreadProcStatus added in v0.18.0

func NewThreadProcStatus(pid, tid int) (*ProcStatus, error)

NewThreadProcStatus reads the /proc/<pid>/task/<tid>/status file and parses it into a ProcStatus struct.

func (*ProcStatus) GetName added in v0.18.0

func (s *ProcStatus) GetName() string

GetName returns the name of the process.

func (*ProcStatus) GetNsPPid added in v0.18.0

func (s *ProcStatus) GetNsPPid() int

GetNsPPid returns process group ID in the namespace of the process.

func (*ProcStatus) GetNsPid added in v0.18.0

func (s *ProcStatus) GetNsPid() int

GetNsPid returns process ID in the namespace of the process.

func (*ProcStatus) GetNsTgid added in v0.18.0

func (s *ProcStatus) GetNsTgid() int

GetNsTgid returns thread group ID in the namespace of the process.

func (*ProcStatus) GetPPid added in v0.18.0

func (s *ProcStatus) GetPPid() int

GetPPid returns the parent process ID.

func (*ProcStatus) GetPid added in v0.18.0

func (s *ProcStatus) GetPid() int

GetPid returns the process ID.

func (*ProcStatus) GetTgid added in v0.18.0

func (s *ProcStatus) GetTgid() int

GetTgid returns the thread group ID.

Jump to

Keyboard shortcuts

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