Skip to content

Commit 49edf54

Browse files
authored
Merge pull request #273 from dcantah/threaded-comment
Docs: Add section on setting/getting cgroup2 type
2 parents 15b69b8 + ebb404e commit 49edf54

1 file changed

Lines changed: 21 additions & 0 deletions

File tree

README.md

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -201,6 +201,27 @@ if err != nil {
201201
}
202202
```
203203

204+
205+
### Get and set cgroup type
206+
```go
207+
m, err := cgroup2.LoadSystemd("/", "my-cgroup-abc.slice")
208+
if err != nil {
209+
return err
210+
}
211+
212+
// https://www.kernel.org/doc/html/v5.0/admin-guide/cgroup-v2.html#threads
213+
cgType, err := m.GetType()
214+
if err != nil {
215+
return err
216+
}
217+
fmt.Println(cgType)
218+
219+
err = m.SetType(cgroup2.Threaded)
220+
if err != nil {
221+
return err
222+
}
223+
```
224+
204225
### Attention
205226

206227
All static path should not include `/sys/fs/cgroup/` prefix, it should start with your own cgroups name

0 commit comments

Comments
 (0)