procfs

package
v0.16.0-alpha Latest Latest
Warning

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

Go to latest
Published: Aug 24, 2020 License: Apache-2.0 Imports: 15 Imported by: 2

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type FileSystem

type FileSystem struct {
	MountPoint string
	// contains filtered or unexported fields
}

FileSystem represents data accessible through the proc pseudo-filesystem.

func NewFileSystem

func NewFileSystem(mountPoint string) (*FileSystem, error)

NewFileSystem returns a new concrete procfs FileSystem instance attached to the specified mount point. If the mount point is unspecified, the shared instance for the default /proc mount point is returned.

func (*FileSystem) BootID

func (fs *FileSystem) BootID() string

BootID returns the kernel's boot identifier retrieved from the file sys/kernel/random/boot_id.

func (*FileSystem) HostFileSystem

func (fs *FileSystem) HostFileSystem() proc.FileSystem

HostFileSystem returns a FileSystem representing the underlying host's procfs from the perspective of the active proc.FileSystem. If the calling process is running in the host pid namespace, the receiver may return itself. If the calling process is running in a container and no host proc filesystem is mounted in, the return will be nil. If cgroups are not enabled on the system, the host filesystem is the same as the calling filesystem.

func (*FileSystem) KernelTextSymbolNames

func (fs *FileSystem) KernelTextSymbolNames() (map[string]string, error)

KernelTextSymbolNames returns a mapping of kernel symbols in the text segment. For each symbol in the map, the key is the source name for the symbol, and the value is the actual linker name that should be used for things like kprobes.

func (*FileSystem) MaxPID

func (fs *FileSystem) MaxPID() uint

MaxPID returns the maximum PID that the kernel will use.

func (*FileSystem) Mounts

func (fs *FileSystem) Mounts() []proc.Mount

Mounts returns the list of currently mounted filesystems.

func (*FileSystem) NumCPU

func (fs *FileSystem) NumCPU() int

NumCPU returns the number of CPUs on the system. This differs from runtime.NumCPU in that runtime.NumCPU returns the number of logical CPUs available to the calling process.

func (*FileSystem) PerfEventDir

func (fs *FileSystem) PerfEventDir() string

PerfEventDir returns the perf_event cgroup mountpoint to use to monitor specific cgroups. Return the empty string if no perf_event cgroup filesystem is mounted.

func (*FileSystem) ProcessCommandLine

func (fs *FileSystem) ProcessCommandLine(pid int) ([]string, error)

ProcessCommandLine returns the full command-line arguments for the process indicated by the given PID.

func (*FileSystem) ProcessContainerID

func (fs *FileSystem) ProcessContainerID(pid int) (string, error)

ProcessContainerID returns the container ID running the specified process. If the process is not running inside of a container, the return will be the empty string.

func (*FileSystem) ProcessExecutable

func (fs *FileSystem) ProcessExecutable(pid int) (string, error)

ProcessExecutable returns the name of the executable from exe file

func (*FileSystem) ProcessMappings

func (fs *FileSystem) ProcessMappings(pid int) ([]proc.MemoryMapping, error)

ProcessMappings returns the memory mappings a process currently has

func (*FileSystem) ReadFile

func (fs *FileSystem) ReadFile(relativePath string) ([]byte, error)

ReadFile returns the contents of the procfs file indicated by the given relative path.

func (*FileSystem) ReadFileOrPanic

func (fs *FileSystem) ReadFileOrPanic(relativePath string) []byte

ReadFileOrPanic returns the contents of the procfs file indicated by the given relative path. If the file cannot be read, glog.Fatal will be called.

func (*FileSystem) ReadTaskStatus

func (fs *FileSystem) ReadTaskStatus(tgid, pid int, i interface{}) error

ReadTaskStatus reads the status of a task, storing the information into the supplied struct. The supplied struct must be a pointer.

func (*FileSystem) SelfTGID

func (fs *FileSystem) SelfTGID() int

SelfTGID returns the TGID of the calling task.

func (*FileSystem) SupportedFilesystems

func (fs *FileSystem) SupportedFilesystems() []string

SupportedFilesystems returns a list of filesystem types supported by the system.

func (*FileSystem) TaskCWD

func (fs *FileSystem) TaskCWD(tgid, pid int) (string, error)

TaskCWD returns the current working directory for the specified task.

func (*FileSystem) TaskControlGroups

func (fs *FileSystem) TaskControlGroups(tgid, pid int) ([]proc.ControlGroup, error)

TaskControlGroups returns the cgroup membership of the specified task.

func (*FileSystem) TaskStartTime

func (fs *FileSystem) TaskStartTime(tgid, pid int) (int64, error)

TaskStartTime returns the time at which the specified task started.

func (*FileSystem) TaskUniqueID

func (fs *FileSystem) TaskUniqueID(tgid, pid int, startTime int64) string

TaskUniqueID returns a unique task ID for a PID.

func (*FileSystem) TracingDir

func (fs *FileSystem) TracingDir() string

TracingDir returns the tracefs mountpoint to use to control the Linux kernel trace event subsystem. Returns the empty string if no tracefs filesystem is mounted.

func (*FileSystem) WalkTasks

func (fs *FileSystem) WalkTasks(walkFunc proc.TaskWalkFunc) error

WalkTasks calls the specified function for each task present in the proc FileSystem. If the walk function returns false, the walk will be aborted.

Jump to

Keyboard shortcuts

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