cgroups

package
v0.9.3 Latest Latest
Warning

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

Go to latest
Published: Jun 8, 2026 License: Apache-2.0 Imports: 6 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Config

type Config struct {
	CPUPeriod        uint64
	CPUQuota         int64
	CPUShares        uint64
	CpusetCpus       string
	CpusetMems       string
	Memory           int64
	MemorySwap       int64
	MemorySwappiness *uint64
	PidsLimit        int64
	BlkioWeight      uint16
	NanoCpus         int64
	OomKillDisable   bool
}

Config holds cgroup configuration.

type Manager

type Manager struct {
	// contains filtered or unexported fields
}

Manager manages cgroups v2 for containers.

func NewManager

func NewManager(root string) *Manager

NewManager creates a new cgroup manager.

func (*Manager) AddProcess

func (m *Manager) AddProcess(containerID string, pid int) error

AddProcess adds a process to the cgroup.

func (*Manager) Create

func (m *Manager) Create(containerID string, cfg *Config) (string, error)

Create creates a cgroup for a container.

func (*Manager) Destroy

func (m *Manager) Destroy(containerID string) error

Destroy removes the cgroup for a container.

func (*Manager) Freeze

func (m *Manager) Freeze(containerID string) error

Freeze pauses a container by moving it to a frozen cgroup.

func (*Manager) GetStats

func (m *Manager) GetStats(containerID string) (map[string]interface{}, error)

GetStats returns cgroup statistics for a container.

func (*Manager) IsAvailable

func (m *Manager) IsAvailable() bool

IsAvailable checks if cgroups v2 is available.

func (*Manager) KillAll

func (m *Manager) KillAll(containerID string) error

KillAll sends a signal to all processes in the cgroup.

func (*Manager) Thaw

func (m *Manager) Thaw(containerID string) error

Thaw resumes a paused container.

Jump to

Keyboard shortcuts

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