fix(deps): update module github.com/opencontainers/cgroups to v0.0.5
Signed-off-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
This commit is contained in:
parent
48ac5410cb
commit
296a8f3eb4
2
go.mod
2
go.mod
|
@ -20,7 +20,7 @@ require (
|
|||
github.com/moby/buildkit v0.23.2
|
||||
github.com/moby/sys/capability v0.4.0
|
||||
github.com/moby/sys/userns v0.1.0
|
||||
github.com/opencontainers/cgroups v0.0.4
|
||||
github.com/opencontainers/cgroups v0.0.5
|
||||
github.com/opencontainers/go-digest v1.0.0
|
||||
github.com/opencontainers/image-spec v1.1.1
|
||||
github.com/opencontainers/runc v1.3.0
|
||||
|
|
4
go.sum
4
go.sum
|
@ -199,8 +199,8 @@ github.com/onsi/ginkgo/v2 v2.25.1 h1:Fwp6crTREKM+oA6Cz4MsO8RhKQzs2/gOIVOUscMAfZY
|
|||
github.com/onsi/ginkgo/v2 v2.25.1/go.mod h1:ppTWQ1dh9KM/F1XgpeRqelR+zHVwV81DGRSDnFxK7Sk=
|
||||
github.com/onsi/gomega v1.38.0 h1:c/WX+w8SLAinvuKKQFh77WEucCnPk4j2OTUr7lt7BeY=
|
||||
github.com/onsi/gomega v1.38.0/go.mod h1:OcXcwId0b9QsE7Y49u+BTrL4IdKOBOKnD6VQNTJEB6o=
|
||||
github.com/opencontainers/cgroups v0.0.4 h1:XVj8P/IHVms/j+7eh8ggdkTLAxjz84ZzuFyGoE28DR4=
|
||||
github.com/opencontainers/cgroups v0.0.4/go.mod h1:s8lktyhlGUqM7OSRL5P7eAW6Wb+kWPNvt4qvVfzA5vs=
|
||||
github.com/opencontainers/cgroups v0.0.5 h1:DRITAqcOnY0uSBzIpt1RYWLjh5DPDiqUs4fY6Y0ktls=
|
||||
github.com/opencontainers/cgroups v0.0.5/go.mod h1:oWVzJsKK0gG9SCRBfTpnn16WcGEqDI8PAcpMGbqWxcs=
|
||||
github.com/opencontainers/go-digest v1.0.0 h1:apOUWs51W5PlhuyGyz9FCeeBIOUDA/6nW8Oi/yOhh5U=
|
||||
github.com/opencontainers/go-digest v1.0.0/go.mod h1:0JzlMkj0TRzQZfJkVvzbP0HBR3IKzErnv2BNG4W4MAM=
|
||||
github.com/opencontainers/image-spec v1.1.1 h1:y0fUlFfIZhPF1W537XOLg0/fcx6zcHCJwooC2xJA040=
|
||||
|
|
|
@ -29,6 +29,11 @@ type Manager interface {
|
|||
// can be used to merely create a cgroup.
|
||||
Apply(pid int) error
|
||||
|
||||
// AddPid adds a process with a given pid to an existing cgroup.
|
||||
// The subcgroup argument is either empty, or a path relative to
|
||||
// a cgroup under under the manager's cgroup.
|
||||
AddPid(subcgroup string, pid int) error
|
||||
|
||||
// GetPids returns the PIDs of all processes inside the cgroup.
|
||||
GetPids() ([]int, error)
|
||||
|
||||
|
|
|
@ -4,6 +4,8 @@ import (
|
|||
"errors"
|
||||
"fmt"
|
||||
"os"
|
||||
"path"
|
||||
"strings"
|
||||
"sync"
|
||||
|
||||
"golang.org/x/sys/unix"
|
||||
|
@ -139,6 +141,33 @@ func (m *Manager) Apply(pid int) (retErr error) {
|
|||
return retErr
|
||||
}
|
||||
|
||||
// AddPid adds a process with a given pid to an existing cgroup.
|
||||
// The subcgroup argument is either empty, or a path relative to
|
||||
// a cgroup under under the manager's cgroup.
|
||||
func (m *Manager) AddPid(subcgroup string, pid int) (retErr error) {
|
||||
m.mu.Lock()
|
||||
defer m.mu.Unlock()
|
||||
|
||||
c := m.cgroups
|
||||
|
||||
for _, dir := range m.paths {
|
||||
path := path.Join(dir, subcgroup)
|
||||
if !strings.HasPrefix(path, dir) {
|
||||
return fmt.Errorf("bad sub cgroup path: %s", subcgroup)
|
||||
}
|
||||
|
||||
if err := cgroups.WriteCgroupProc(path, pid); err != nil {
|
||||
if isIgnorableError(c.Rootless, err) && c.Path == "" {
|
||||
retErr = cgroups.ErrRootless
|
||||
continue
|
||||
}
|
||||
return err
|
||||
}
|
||||
}
|
||||
|
||||
return retErr
|
||||
}
|
||||
|
||||
func (m *Manager) Destroy() error {
|
||||
m.mu.Lock()
|
||||
defer m.mu.Unlock()
|
||||
|
|
|
@ -4,6 +4,7 @@ import (
|
|||
"errors"
|
||||
"fmt"
|
||||
"os"
|
||||
"path/filepath"
|
||||
"strings"
|
||||
|
||||
"github.com/opencontainers/cgroups"
|
||||
|
@ -83,6 +84,18 @@ func (m *Manager) Apply(pid int) error {
|
|||
return nil
|
||||
}
|
||||
|
||||
// AddPid adds a process with a given pid to an existing cgroup.
|
||||
// The subcgroup argument is either empty, or a path relative to
|
||||
// a cgroup under under the manager's cgroup.
|
||||
func (m *Manager) AddPid(subcgroup string, pid int) error {
|
||||
path := filepath.Join(m.dirPath, subcgroup)
|
||||
if !strings.HasPrefix(path, m.dirPath) {
|
||||
return fmt.Errorf("bad sub cgroup path: %s", subcgroup)
|
||||
}
|
||||
|
||||
return cgroups.WriteCgroupProc(path, pid)
|
||||
}
|
||||
|
||||
func (m *Manager) GetPids() ([]int, error) {
|
||||
return cgroups.GetPids(m.dirPath)
|
||||
}
|
||||
|
|
|
@ -299,7 +299,7 @@ github.com/modern-go/reflect2
|
|||
# github.com/morikuni/aec v1.0.0
|
||||
## explicit
|
||||
github.com/morikuni/aec
|
||||
# github.com/opencontainers/cgroups v0.0.4
|
||||
# github.com/opencontainers/cgroups v0.0.5
|
||||
## explicit; go 1.23.0
|
||||
github.com/opencontainers/cgroups
|
||||
github.com/opencontainers/cgroups/devices/config
|
||||
|
|
Loading…
Reference in New Issue