NewLinuxDistroLimitSet returns a new LimitSet whose values are typical for a booted Linux distro. Many Linux init systems adjust the default Linux limits to values more expected by the rest of the userspace. NewLinuxDistroLimitSet returns a LimitSet with sensible defaults for applications that aren
()
| 103 | // LimitSet with sensible defaults for applications that aren't starting |
| 104 | // their own init system. |
| 105 | func NewLinuxDistroLimitSet() (*LimitSet, error) { |
| 106 | ls, err := NewLinuxLimitSet() |
| 107 | if err != nil { |
| 108 | return nil, err |
| 109 | } |
| 110 | |
| 111 | // Adjust ProcessCount to a lower value because GNU bash allocates 16 |
| 112 | // bytes per proc and OOMs if this number is set too high. Value was |
| 113 | // picked arbitrarily. |
| 114 | // |
| 115 | // 1,048,576 ought to be enough for anyone. |
| 116 | l := ls.Get(ProcessCount) |
| 117 | l.Cur = 1 << 20 |
| 118 | ls.Set(ProcessCount, l, true /* privileged */) |
| 119 | return ls, nil |
| 120 | } |
no test coverage detected
searching dependent graphs…