NewLinuxLimitSet returns a LimitSet whose values match the default rlimits in Linux.
()
| 81 | // NewLinuxLimitSet returns a LimitSet whose values match the default rlimits |
| 82 | // in Linux. |
| 83 | func NewLinuxLimitSet() (*LimitSet, error) { |
| 84 | ls := NewLimitSet() |
| 85 | for rlt, rl := range linux.InitRLimits { |
| 86 | lt, ok := FromLinuxResource[rlt] |
| 87 | if !ok { |
| 88 | return nil, fmt.Errorf("unknown rlimit type %v", rlt) |
| 89 | } |
| 90 | ls.SetUnchecked(lt, Limit{ |
| 91 | Cur: FromLinux(rl.Cur), |
| 92 | Max: FromLinux(rl.Max), |
| 93 | }) |
| 94 | } |
| 95 | return ls, nil |
| 96 | } |
| 97 | |
| 98 | // NewLinuxDistroLimitSet returns a new LimitSet whose values are typical |
| 99 | // for a booted Linux distro. |
no test coverage detected
searching dependent graphs…