mirror of
https://github.com/superseriousbusiness/gotosocial.git
synced 2025-02-09 22:30:16 +00:00
Bumps [github.com/KimMachineGun/automemlimit](https://github.com/KimMachineGun/automemlimit) from 0.6.1 to 0.7.0. - [Release notes](https://github.com/KimMachineGun/automemlimit/releases) - [Commits](https://github.com/KimMachineGun/automemlimit/compare/v0.6.1...v0.7.0) --- updated-dependencies: - dependency-name: github.com/KimMachineGun/automemlimit dependency-type: direct:production update-type: version-update:semver-minor ... Signed-off-by: dependabot[bot] <support@github.com> Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
33 lines
1 KiB
Go
33 lines
1 KiB
Go
//go:build linux
|
|
// +build linux
|
|
|
|
package memlimit
|
|
|
|
// FromCgroup retrieves the memory limit from the cgroup.
|
|
func FromCgroup() (uint64, error) {
|
|
return fromCgroup(detectCgroupVersion)
|
|
}
|
|
|
|
// FromCgroupV1 retrieves the memory limit from the cgroup v1 controller.
|
|
// After v1.0.0, this function could be removed and FromCgroup should be used instead.
|
|
func FromCgroupV1() (uint64, error) {
|
|
return fromCgroup(func(_ []mountInfo) (bool, bool) {
|
|
return true, false
|
|
})
|
|
}
|
|
|
|
// FromCgroupHybrid retrieves the memory limit from the cgroup v2 and v1 controller sequentially,
|
|
// basically, it is equivalent to FromCgroup.
|
|
// After v1.0.0, this function could be removed and FromCgroup should be used instead.
|
|
func FromCgroupHybrid() (uint64, error) {
|
|
return FromCgroup()
|
|
}
|
|
|
|
// FromCgroupV2 retrieves the memory limit from the cgroup v2 controller.
|
|
// After v1.0.0, this function could be removed and FromCgroup should be used instead.
|
|
func FromCgroupV2() (uint64, error) {
|
|
return fromCgroup(func(_ []mountInfo) (bool, bool) {
|
|
return false, true
|
|
})
|
|
}
|