You've already forked runc
mirror of
https://github.com/opencontainers/runc.git
synced 2025-07-30 17:43:06 +03:00
When we use cgroup with systemd driver, the cgroup path will be auto removed by systemd when all processes exited. So we should check cgroup path exists when we access the cgroup path, for example in `kill/ps`, or else we will got an error. Signed-off-by: lifubang <lifubang@acmcoder.com>
72 lines
1.5 KiB
Go
72 lines
1.5 KiB
Go
// +build !linux
|
|
|
|
package systemd
|
|
|
|
import (
|
|
"errors"
|
|
|
|
"github.com/opencontainers/runc/libcontainer/cgroups"
|
|
"github.com/opencontainers/runc/libcontainer/configs"
|
|
)
|
|
|
|
type Manager struct {
|
|
Cgroups *configs.Cgroup
|
|
Paths map[string]string
|
|
}
|
|
|
|
func IsRunningSystemd() bool {
|
|
return false
|
|
}
|
|
|
|
func NewSystemdCgroupsManager() (func(config *configs.Cgroup, paths map[string]string) cgroups.Manager, error) {
|
|
return nil, errors.New("Systemd not supported")
|
|
}
|
|
|
|
func (m *Manager) Apply(pid int) error {
|
|
return errors.New("Systemd not supported")
|
|
}
|
|
|
|
func (m *Manager) GetPids() ([]int, error) {
|
|
return nil, errors.New("Systemd not supported")
|
|
}
|
|
|
|
func (m *Manager) GetAllPids() ([]int, error) {
|
|
return nil, errors.New("Systemd not supported")
|
|
}
|
|
|
|
func (m *Manager) Destroy() error {
|
|
return errors.New("Systemd not supported")
|
|
}
|
|
|
|
func (m *Manager) GetPaths() map[string]string {
|
|
return nil
|
|
}
|
|
|
|
func (m *Manager) Path(_ string) string {
|
|
return ""
|
|
}
|
|
|
|
func (m *Manager) GetStats() (*cgroups.Stats, error) {
|
|
return nil, errors.New("Systemd not supported")
|
|
}
|
|
|
|
func (m *Manager) Set(container *configs.Config) error {
|
|
return errors.New("Systemd not supported")
|
|
}
|
|
|
|
func (m *Manager) Freeze(state configs.FreezerState) error {
|
|
return errors.New("Systemd not supported")
|
|
}
|
|
|
|
func Freeze(c *configs.Cgroup, state configs.FreezerState) error {
|
|
return errors.New("Systemd not supported")
|
|
}
|
|
|
|
func (m *Manager) GetCgroups() (*configs.Cgroup, error) {
|
|
return nil, errors.New("Systemd not supported")
|
|
}
|
|
|
|
func (m *Manager) Exists() bool {
|
|
return false
|
|
}
|