proc

package
v0.0.0-...-1c5d739 Latest Latest
Warning

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

Go to latest
Published: Dec 14, 2023 License: Apache-2.0 Imports: 13 Imported by: 5

Documentation

Index

Constants

This section is empty.

Variables

View Source
var ErrMountPointNotExported = fmt.Errorf("mount point not exported")
View Source
var ErrMountPointNotFound = errors.New("mount point not found")
View Source
var MalformedStatErr = fmt.Errorf("malformed stat file")

Functions

func GetAllPids

func GetAllPids() ([]int, error)

GetAllPids finds all processes under the /proc directory

func GetProcNFSDExports

func GetProcNFSDExports() (map[string]ProcNFSDExports, error)

GetProcNFSDExports gets a map to the /proc/fs/nfs/exports

func GetProcNFSDExportsFilePath

func GetProcNFSDExportsFilePath() string

func GetProcNFSFSServers

func GetProcNFSFSServers() (map[string]ProcNFSFSServer, error)

GetProcNFSFSServers gets a map to the /proc/fs/nfsfs/servers

func KillGroup

func KillGroup(pgrp int, timeout time.Duration) error

KillGroup will send a SIGTERM to all the processes in the pgrp processs group. If the processes don't shutdown within 10 seconds

func ReapZombies

func ReapZombies()

ReapZombies will call wait on zombie pids in order to reap them.

Types

type MountInfo

type MountInfo struct {
	DeviceID   string // device id: 0:137
	FSType     string // filesystem type: btrfs, nfs4, ext4
	RemotePath string // path to the server: 10.87.209.168:/serviced_var
	LocalPath  string // path on the client: /tmp/serviced/var
	ServerIP   string // server ip address: 10.87.209.168
}

MountInfo is retrieved from mountinfo

func GetMountInfo

func GetMountInfo(mountpoint string) (*MountInfo, error)

GetMountInfo gets the mount info of the mountpoint

type NFSDExportOptions

type NFSDExportOptions map[string]string

NFSDExportOptions are options specified in 'General Options' of exports manpage

type NFSMountInfo

type NFSMountInfo struct {
	// from findmnt
	MountInfo

	// from /proc/fs/nfsfs/volumes
	Version  string // nfsversion: v4, v3, ...
	ServerID string // id of server: 0a57d1a8
	Port     string // port on server: 801
	FSCache  string // whether fscache is used (yes/no)
}

NFSVolumeInfo is merged from mountinfo and volumes

func GetNFSVolumeInfo

func GetNFSVolumeInfo(mountpoint string) (*NFSMountInfo, error)

GetNFSVolumeInfo gets the NFSMountInfo of the mountpoint

type ProcNFSDExports

type ProcNFSDExports struct {
	MountPoint    string                       // exported path on the server: /exports/serviced_var
	ClientOptions map[string]NFSDExportOptions // keys are clients: 'Machine Name Formats' of exports manpage
}

ProcNFSDExports is a parsed representation of /proc/fs/nfs/exports information.

func GetProcNFSDExport

func GetProcNFSDExport(mountpoint string) (*ProcNFSDExports, error)

GetProcNFSDExport gets the export info to the mountpoint entry in /proc/fs/nfs/exports

func (*ProcNFSDExports) Equals

func (a *ProcNFSDExports) Equals(b *ProcNFSDExports) bool

Equals checks the equality of two ProcNFSDExports

type ProcNFSFSServer

type ProcNFSFSServer struct {
	Version  string // nfsversion: v4, v3, ...
	ServerID string // id of server: 0a57d1a8
	Port     string // port on server: 801
	Hostname string // hostname of server: 10.87.209.168
}

ProcNFSFSServer is a parsed representation of /proc/fs/nfsfs/servers information.

type ProcNFSFSVolume

type ProcNFSFSVolume struct {
	Version  string // nfsversion: v4, v3, ...
	ServerID string // id of server: 0a57d1a8
	Port     string // port on server: 801
	DeviceID string // device id: 0:137
	FSCache  string // whether fscache is used (yes/no)
}

ProcNFSFSVolume is a parsed representation of /proc/fs/nfsfs/volumes information.

type ProcStat

type ProcStat struct {
	Pid      int    // The process ID.
	Filename string // The filename of the executable, in parentheses. This is visible whether or not the executable is swapped out.
	State    string // One character from the string "RSDZTW" where R is running, S is sleeping in an interruptible wait, D is waiting in uninterruptible disk sleep, Z is zombie, T is traced or stopped
	Ppid     int    // The PID of the parent.
	Pgrp     int    // The process group ID of the process.
	Session  int    // The session ID of the process.
}

ProcStat is a parsed represenation of /proc/PID/stat information.

func GetProcStat

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

GetProcStat gets the /proc/pid/stat info for the given pid.

Jump to

Keyboard shortcuts

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