package fscommon

import "github.com/opencontainers/cgroups/fscommon"

Index

Variables

var (
	// Deprecated: use cgroups.OpenFile instead.
	OpenFile = cgroups.OpenFile
	// Deprecated: use cgroups.ReadFile instead.
	ReadFile = cgroups.ReadFile
	// Deprecated: use cgroups.WriteFile instead.
	WriteFile = cgroups.WriteFile
)

Functions

func GetCgroupParamInt

func GetCgroupParamInt(path, file string) (int64, error)

GetCgroupParamInt reads a single int64 value from specified cgroup file. If the value read is "max", the math.MaxInt64 is returned.

func GetCgroupParamString

func GetCgroupParamString(path, file string) (string, error)

GetCgroupParamString reads a string from the specified cgroup file.

func GetCgroupParamUint

func GetCgroupParamUint(path, file string) (uint64, error)

GetCgroupParamUint reads a single uint64 value from the specified cgroup file. If the value read is "max", the math.MaxUint64 is returned.

func GetValueByKey

func GetValueByKey(path, file, key string) (uint64, error)

GetValueByKey reads space-separated "key value" pairs from the specified cgroup file, looking for a specified key, and returns its value as uint64, using ParseUint for conversion. If the value is not found, 0 is returned.

func ParseKeyValue

func ParseKeyValue(t string) (string, uint64, error)

ParseKeyValue parses a space-separated "key value" kind of cgroup parameter and returns its key as a string, and its value as uint64 (using ParseUint to convert the value). For example, "io_service_bytes 1234" will be returned as "io_service_bytes", 1234.

func ParseUint

func ParseUint(s string, base, bitSize int) (uint64, error)

ParseUint converts a string to an uint64 integer. Negative values are returned at zero as, due to kernel bugs, some of the memory cgroup stats can be negative.

func RdmaGetStats

func RdmaGetStats(path string, stats *cgroups.Stats) error

RdmaGetStats returns rdma stats such as totalLimit and current entries.

func RdmaSet

func RdmaSet(path string, r *cgroups.Resources) error

RdmaSet sets RDMA resources.

Types

type ParseError

type ParseError struct {
	Path string
	File string
	Err  error
}

ParseError records a parse error details, including the file path.

func (*ParseError) Error

func (e *ParseError) Error() string

func (*ParseError) Unwrap

func (e *ParseError) Unwrap() error

Source Files

rdma.go utils.go

Version
v0.0.1 (latest)
Published
Feb 28, 2025
Platform
linux/amd64
Imports
10 packages
Last checked
1 month ago

Tools for package owners.