MCPcopy Create free account
hub / github.com/containerd/cgroups / write

Method write

cgroup2/manager.go:155–179  ·  view source on GitHub ↗

write the value to the full, absolute path, of a unified hierarchy

(path string, perm os.FileMode)

Source from the content-addressed store, hash-verified

153
154// write the value to the full, absolute path, of a unified hierarchy
155func (c *Value) write(path string, perm os.FileMode) error {
156 var data []byte
157 switch t := c.value.(type) {
158 case uint64:
159 data = []byte(strconv.FormatUint(t, 10))
160 case uint16:
161 data = []byte(strconv.FormatUint(uint64(t), 10))
162 case int64:
163 data = []byte(strconv.FormatInt(t, 10))
164 case []byte:
165 data = t
166 case string:
167 data = []byte(t)
168 case CPUMax:
169 data = []byte(t)
170 default:
171 return ErrInvalidFormat
172 }
173
174 return os.WriteFile(
175 filepath.Join(path, c.filename),
176 data,
177 perm,
178 )
179}
180
181func writeValues(path string, values []Value) error {
182 for _, o := range values {

Callers 1

writeValuesFunction · 0.80

Calls

no outgoing calls

Tested by

no test coverage detected