MCPcopy
hub / github.com/google/gvisor / NewLinuxLimitSet

Function NewLinuxLimitSet

pkg/sentry/limits/linux.go:83–96  ·  view source on GitHub ↗

NewLinuxLimitSet returns a LimitSet whose values match the default rlimits in Linux.

()

Source from the content-addressed store, hash-verified

81// NewLinuxLimitSet returns a LimitSet whose values match the default rlimits
82// in Linux.
83func 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.

Callers 3

BootFunction · 0.92
initDefaultsMethod · 0.92
NewLinuxDistroLimitSetFunction · 0.85

Calls 4

SetUncheckedMethod · 0.95
NewLimitSetFunction · 0.85
FromLinuxFunction · 0.85
ErrorfMethod · 0.65

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…