2013-12-17 22:09:17 +00:00
|
|
|
// cmpout
|
|
|
|
// +build ignore
|
|
|
|
|
|
|
|
package main
|
|
|
|
|
|
|
|
import (
|
2015-12-06 13:09:38 +00:00
|
|
|
"."
|
2013-12-17 22:09:17 +00:00
|
|
|
"fmt"
|
|
|
|
)
|
|
|
|
|
|
|
|
func main() {
|
|
|
|
cgroup.Init()
|
|
|
|
|
2015-12-06 13:09:38 +00:00
|
|
|
g := cgroup.NewCgroup("foo")
|
|
|
|
c := g.AddController("bar")
|
|
|
|
fmt.Printf("%#v\n", c)
|
|
|
|
c = g.GetController("bar")
|
|
|
|
fmt.Printf("%#v\n", c)
|
2013-12-17 22:09:17 +00:00
|
|
|
|
2015-12-06 13:09:38 +00:00
|
|
|
g.SetPermissions(cgroup.Mode(0777), cgroup.Mode(0777), cgroup.Mode(0777))
|
2013-12-17 22:09:17 +00:00
|
|
|
|
|
|
|
ctls, err := cgroup.GetAllControllers()
|
|
|
|
if err != nil {
|
|
|
|
fmt.Println(err)
|
|
|
|
return
|
|
|
|
}
|
|
|
|
for i := range ctls {
|
2015-12-06 13:09:38 +00:00
|
|
|
fmt.Printf("Hierarchy=%d Enabled=%d NumCgroups=%d Name=%s\n", ctls[i].Hierarchy, ctls[i].Enabled, ctls[i].NumCgroups, ctls[i].Name)
|
2013-12-17 22:09:17 +00:00
|
|
|
}
|
|
|
|
}
|