proc

package
v1.3.2 Latest Latest
Warning

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

Go to latest
Published: May 28, 2024 License: BSD-3-Clause Imports: 8 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func CountChilds

func CountChilds(pid int) (int, error)

CountChilds returns the number of child processes for a given process id

func ExtractPid

func ExtractPid(path string) (pid uint, err error)

ExtractPid returns a pid extracted from path of type "/proc/1"

func GetMountPointMap

func GetMountPointMap(path string) (map[string][]string, error)

GetMountPointMap parses mountinfo pointing to path and returns a map of parent mount points with associated child mount points.

func Getppid

func Getppid(pid int) (int, error)

Getppid returns the parent process ID for the corresponding process ID passed in parameter.

func HasFilesystem

func HasFilesystem(fs string) (bool, error)

HasFilesystem returns whether kernel support filesystem or not

func HasNamespace

func HasNamespace(pid int, nstype string) (bool, error)

HasNamespace checks if host namespace and container namespace are different.

func ParentMount

func ParentMount(path string) (string, error)

ParentMount parses mountinfo and returns the path of parent mount point for which the provided path is mounted in.

func ReadIDMap

func ReadIDMap(path string) (uint32, uint32, error)

ReadIDMap reads uid_map or gid_map and returns both container ID and host ID

func SetOOMScoreAdj

func SetOOMScoreAdj(pid int, score *int) error

SetOOMScoreAdj sets OOM score for process with pid

Types

type MountInfoEntry

type MountInfoEntry struct {
	ID           string
	ParentID     string
	Dev          string
	Root         string
	Point        string
	Options      []string
	Fields       string
	FSType       string
	Source       string
	SuperOptions []string
}

MountInfoEntry contains parsed fields of a mountinfo line.

func FindParentMountEntry

func FindParentMountEntry(path string, entries []MountInfoEntry) (*MountInfoEntry, error)

FindParentMountEntry finds the parent mount point entry associated to the provided path among the entry list provided in argument.

func GetMountInfoEntry

func GetMountInfoEntry(path string) ([]MountInfoEntry, error)

GetMountInfoEntry parses a mountinfo file and returns all parsed entries as an array of MountInfoEntry.

Jump to

Keyboard shortcuts

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