1
0
Fork 0
mirror of https://github.com/vbatts/go-cgroup.git synced 2025-02-18 18:16:02 +00:00
go-cgroup/main.go
Sjon Hortensius 599fa1f9ff 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
2015-12-06 14:09:38 +01:00

30 lines
559 B
Go

// cmpout
// +build ignore
package main
import (
"."
"fmt"
)
func main() {
cgroup.Init()
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))
ctls, err := cgroup.GetAllControllers()
if err != nil {
fmt.Println(err)
return
}
for i := range ctls {
fmt.Printf("Hierarchy=%d Enabled=%d NumCgroups=%d Name=%s\n", ctls[i].Hierarchy, ctls[i].Enabled, ctls[i].NumCgroups, ctls[i].Name)
}
}