summaryrefslogtreecommitdiff
path: root/vendor/github.com/KimMachineGun/automemlimit/memlimit/cgroups.go
diff options
context:
space:
mode:
authorLibravatar kim <grufwub@gmail.com>2025-07-22 18:00:27 +0200
committerLibravatar kim <gruf@noreply.codeberg.org>2025-07-22 18:00:27 +0200
commitc00cad2cebcb8136a998f6f7ba2c27672f785d10 (patch)
tree863516d8459713cc4b91c83d8aeeef3cac486b39 /vendor/github.com/KimMachineGun/automemlimit/memlimit/cgroups.go
parent[chore/deps] Upgrade to go-sqlite 0.27.1 (#4334) (diff)
downloadgotosocial-c00cad2cebcb8136a998f6f7ba2c27672f785d10.tar.xz
[chore] bump dependencies (#4339)
- github.com/KimMachineGun/automemlimit v0.7.4 - github.com/miekg/dns v1.1.67 - github.com/minio/minio-go/v7 v7.0.95 - github.com/spf13/pflag v1.0.7 - github.com/tdewolff/minify/v2 v2.23.9 - github.com/uptrace/bun v1.2.15 - github.com/uptrace/bun/dialect/pgdialect v1.2.15 - github.com/uptrace/bun/dialect/sqlitedialect v1.2.15 - github.com/uptrace/bun/extra/bunotel v1.2.15 - golang.org/x/image v0.29.0 - golang.org/x/net v0.42.0 Reviewed-on: https://codeberg.org/superseriousbusiness/gotosocial/pulls/4339 Co-authored-by: kim <grufwub@gmail.com> Co-committed-by: kim <grufwub@gmail.com>
Diffstat (limited to 'vendor/github.com/KimMachineGun/automemlimit/memlimit/cgroups.go')
-rw-r--r--vendor/github.com/KimMachineGun/automemlimit/memlimit/cgroups.go12
1 files changed, 6 insertions, 6 deletions
diff --git a/vendor/github.com/KimMachineGun/automemlimit/memlimit/cgroups.go b/vendor/github.com/KimMachineGun/automemlimit/memlimit/cgroups.go
index 69d1771f0..81559e3bf 100644
--- a/vendor/github.com/KimMachineGun/automemlimit/memlimit/cgroups.go
+++ b/vendor/github.com/KimMachineGun/automemlimit/memlimit/cgroups.go
@@ -157,7 +157,7 @@ func getMemoryLimitV1(chs []cgroupHierarchy, mis []mountInfo) (uint64, error) {
return 0, err
}
- // retrieve the memory limit from the memory.stats and memory.limit_in_bytes files.
+ // retrieve the memory limit from the memory.stat and memory.limit_in_bytes files.
return readMemoryLimitV1FromPath(cgroupPath)
}
@@ -173,7 +173,7 @@ func getCgroupV1NoLimit() uint64 {
func readMemoryLimitV1FromPath(cgroupPath string) (uint64, error) {
// read hierarchical_memory_limit and memory.limit_in_bytes files.
// but if hierarchical_memory_limit is not available, then use the max value as a fallback.
- hml, err := readHierarchicalMemoryLimit(filepath.Join(cgroupPath, "memory.stats"))
+ hml, err := readHierarchicalMemoryLimit(filepath.Join(cgroupPath, "memory.stat"))
if err != nil && !errors.Is(err, os.ErrNotExist) {
return 0, fmt.Errorf("failed to read hierarchical_memory_limit: %w", err)
} else if hml == 0 {
@@ -202,8 +202,8 @@ func readMemoryLimitV1FromPath(cgroupPath string) (uint64, error) {
return limit, nil
}
-// readHierarchicalMemoryLimit extracts hierarchical_memory_limit from memory.stats.
-// this function expects the path to be memory.stats file.
+// readHierarchicalMemoryLimit extracts hierarchical_memory_limit from memory.stat.
+// this function expects the path to be memory.stat file.
func readHierarchicalMemoryLimit(path string) (uint64, error) {
file, err := os.Open(path)
if err != nil {
@@ -217,12 +217,12 @@ func readHierarchicalMemoryLimit(path string) (uint64, error) {
fields := strings.Split(line, " ")
if len(fields) < 2 {
- return 0, fmt.Errorf("failed to parse memory.stats %q: not enough fields", line)
+ return 0, fmt.Errorf("failed to parse memory.stat %q: not enough fields", line)
}
if fields[0] == "hierarchical_memory_limit" {
if len(fields) > 2 {
- return 0, fmt.Errorf("failed to parse memory.stats %q: too many fields for hierarchical_memory_limit", line)
+ return 0, fmt.Errorf("failed to parse memory.stat %q: too many fields for hierarchical_memory_limit", line)
}
return strconv.ParseUint(fields[1], 10, 64)
}