proc

package
v0.0.0-...-2eaf2e4 Latest Latest
Warning

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

Go to latest
Published: Aug 14, 2022 License: MIT Imports: 14 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func GetCommand

func GetCommand(pid PID) string

func GetEnv

func GetEnv(pid PID) ([]string, error)

func Info

func Info(pid PID) (string, error)

func Kill

func Kill(pid PID) error

func NewProcDataSource

func NewProcDataSource() (*procDataSource, error)

func OpenFiles

func OpenFiles(pid PID) (string, error)

Types

type ChdirData

type ChdirData struct {
	Cwd string
}

type Datasource

type Datasource[T any] struct {
	Get       func(pid PID) (T, error)
	GetStream func() (chan PID, chan T, error)
}

func NewChdirDataSource

func NewChdirDataSource() (Datasource[ChdirData], error)

func NewExecDataSource

func NewExecDataSource() (Datasource[ExecData], error)

func NewOpenDataSource

func NewOpenDataSource() (Datasource[OpenData], error)

func NewSource

func NewSource[T any](program string,
	process func(line string) (PID, T, error),
	get ...func(pid PID) (T, error),
) (Datasource[T], error)

type ExecData

type ExecData struct {
	PPID    PID
	Command string
}

type OpenData

type OpenData struct {
	Filepath string
}

type PID

type PID string

func GetChildren

func GetChildren(pid PID) []PID

func (PID) Int

func (p PID) Int() int

func (PID) String

func (p PID) String() string

type ProcDataSource

type ProcDataSource interface {
	GetProcesses(filters ...string) map[PID]Process
	GetProcess(pid PID) *Process

	// ebpf based
	GetExecTrace(pid PID) []ExecData
	GetOpenTrace(pid PID) []OpenData
	GetChdirTrace(pid PID) []ChdirData
}

type Process

type Process struct {
	Pid   PID
	PPid  PID
	Cmd   string
	Child []PID
}

Jump to

Keyboard shortcuts

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