mirror of
https://github.com/containers/podman.git
synced 2025-12-08 23:00:23 +08:00
bump c/common to latest main
Includes the fixes for the search filter changes. [NO NEW TESTS NEEDED] Signed-off-by: Paul Holzinger <pholzing@redhat.com>
This commit is contained in:
4
vendor/github.com/containers/common/pkg/cgroups/cgroups.go
generated
vendored
4
vendor/github.com/containers/common/pkg/cgroups/cgroups.go
generated
vendored
@@ -582,7 +582,7 @@ func (c *CgroupControl) Stat() (*Metrics, error) {
|
||||
return &m, nil
|
||||
}
|
||||
|
||||
func readCgroup2MapPath(path string) (map[string][]string, error) {
|
||||
func readCgroupMapPath(path string) (map[string][]string, error) {
|
||||
ret := map[string][]string{}
|
||||
f, err := os.Open(path)
|
||||
if err != nil {
|
||||
@@ -610,5 +610,5 @@ func readCgroup2MapPath(path string) (map[string][]string, error) {
|
||||
func readCgroup2MapFile(ctr *CgroupControl, name string) (map[string][]string, error) {
|
||||
p := filepath.Join(cgroupRoot, ctr.path, name)
|
||||
|
||||
return readCgroup2MapPath(p)
|
||||
return readCgroupMapPath(p)
|
||||
}
|
||||
|
||||
4
vendor/github.com/containers/common/pkg/cgroups/cgroups_linux.go
generated
vendored
4
vendor/github.com/containers/common/pkg/cgroups/cgroups_linux.go
generated
vendored
@@ -542,7 +542,7 @@ func (c *CgroupControl) Stat() (*cgroups.Stats, error) {
|
||||
return &m, nil
|
||||
}
|
||||
|
||||
func readCgroup2MapPath(path string) (map[string][]string, error) {
|
||||
func readCgroupMapPath(path string) (map[string][]string, error) {
|
||||
ret := map[string][]string{}
|
||||
f, err := os.Open(path)
|
||||
if err != nil {
|
||||
@@ -570,5 +570,5 @@ func readCgroup2MapPath(path string) (map[string][]string, error) {
|
||||
func readCgroup2MapFile(ctr *CgroupControl, name string) (map[string][]string, error) {
|
||||
p := filepath.Join(cgroupRoot, ctr.config.Path, name)
|
||||
|
||||
return readCgroup2MapPath(p)
|
||||
return readCgroupMapPath(p)
|
||||
}
|
||||
|
||||
21
vendor/github.com/containers/common/pkg/cgroups/memory_linux.go
generated
vendored
21
vendor/github.com/containers/common/pkg/cgroups/memory_linux.go
generated
vendored
@@ -4,7 +4,9 @@
|
||||
package cgroups
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
"path/filepath"
|
||||
"strconv"
|
||||
|
||||
"github.com/opencontainers/runc/libcontainer/cgroups"
|
||||
"github.com/opencontainers/runc/libcontainer/cgroups/fs"
|
||||
@@ -63,9 +65,26 @@ func (c *linuxMemHandler) Stat(ctr *CgroupControl, m *cgroups.Stats) error {
|
||||
} else {
|
||||
memoryRoot = ctr.getCgroupv1Path(Memory)
|
||||
limitFilename = "memory.limit_in_bytes"
|
||||
if memUsage.Usage.Usage, err = readFileAsUint64(filepath.Join(memoryRoot, "memory.usage_in_bytes")); err != nil {
|
||||
|
||||
path := filepath.Join(memoryRoot, "memory.stat")
|
||||
values, err := readCgroupMapPath(path)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
// cgroup v1 does not have a single "anon" field, but we can calculate it
|
||||
// from total_active_anon and total_inactive_anon
|
||||
memUsage.Usage.Usage = 0
|
||||
for _, key := range []string{"total_active_anon", "total_inactive_anon"} {
|
||||
if _, found := values[key]; !found {
|
||||
continue
|
||||
}
|
||||
res, err := strconv.ParseUint(values[key][0], 10, 64)
|
||||
if err != nil {
|
||||
return fmt.Errorf("parse %s from %s: %w", key, path, err)
|
||||
}
|
||||
memUsage.Usage.Usage += res
|
||||
}
|
||||
}
|
||||
|
||||
memUsage.Usage.Limit, err = readFileAsUint64(filepath.Join(memoryRoot, limitFilename))
|
||||
|
||||
2
vendor/github.com/containers/common/pkg/cgroups/utils.go
generated
vendored
2
vendor/github.com/containers/common/pkg/cgroups/utils.go
generated
vendored
@@ -64,7 +64,7 @@ func GetSystemCPUUsage() (uint64, error) {
|
||||
}
|
||||
p := filepath.Join(cgroupRoot, file.Name(), "cpu.stat")
|
||||
|
||||
values, err := readCgroup2MapPath(p)
|
||||
values, err := readCgroupMapPath(p)
|
||||
if err != nil {
|
||||
return 0, err
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user