mirror of
https://github.com/vbatts/go-cgroup.git
synced 2025-10-04 13:21:00 +00:00
2 Bugfixes plus minor readability fix in main
* correct type of Cgroup.g * fix GetAllControllers, ECGEOF is indicator of end already reached so don't append cd again
This commit is contained in:
parent
70e3da7eb3
commit
599fa1f9ff
2 changed files with 16 additions and 18 deletions
20
main.go
20
main.go
|
@ -1,34 +1,30 @@
|
|||
// cmpout
|
||||
|
||||
// +build ignore
|
||||
|
||||
package main
|
||||
|
||||
import (
|
||||
"."
|
||||
"."
|
||||
"fmt"
|
||||
)
|
||||
|
||||
func main() {
|
||||
cgroup.Init()
|
||||
fmt.Println(cgroup.DeleteIgnoreMigration)
|
||||
fmt.Println(cgroup.DeleteIgnoreMigration|cgroup.DeleteEmptyOnly)
|
||||
|
||||
g := cgroup.NewCgroup("foo")
|
||||
c := g.AddController("bar")
|
||||
fmt.Printf("%#v\n", c)
|
||||
c = g.GetController("bar")
|
||||
fmt.Printf("%#v\n", c)
|
||||
g := cgroup.NewCgroup("foo")
|
||||
c := g.AddController("bar")
|
||||
fmt.Printf("%#v\n", c)
|
||||
c = g.GetController("bar")
|
||||
fmt.Printf("%#v\n", c)
|
||||
|
||||
g.SetPermissions(cgroup.Mode(0777), cgroup.Mode(0777), cgroup.Mode(0777))
|
||||
g.SetPermissions(cgroup.Mode(0777), cgroup.Mode(0777), cgroup.Mode(0777))
|
||||
|
||||
//fmt.Println(cgroup.GetSubSysMountPoint("cpu"))
|
||||
ctls, err := cgroup.GetAllControllers()
|
||||
if err != nil {
|
||||
fmt.Println(err)
|
||||
return
|
||||
}
|
||||
for i := range ctls {
|
||||
fmt.Println(ctls[i])
|
||||
fmt.Printf("Hierarchy=%d Enabled=%d NumCgroups=%d Name=%s\n", ctls[i].Hierarchy, ctls[i].Enabled, ctls[i].NumCgroups, ctls[i].Name)
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue