net_prio.go 842 B

123456789101112131415161718192021222324252627282930313233343536373839404142
  1. // +build linux
  2. package fs
  3. import (
  4. "github.com/opencontainers/runc/libcontainer/cgroups"
  5. "github.com/opencontainers/runc/libcontainer/configs"
  6. )
  7. type NetPrioGroup struct {
  8. }
  9. func (s *NetPrioGroup) Name() string {
  10. return "net_prio"
  11. }
  12. func (s *NetPrioGroup) Apply(d *cgroupData) error {
  13. _, err := d.join("net_prio")
  14. if err != nil && !cgroups.IsNotFound(err) {
  15. return err
  16. }
  17. return nil
  18. }
  19. func (s *NetPrioGroup) Set(path string, cgroup *configs.Cgroup) error {
  20. for _, prioMap := range cgroup.Resources.NetPrioIfpriomap {
  21. if err := writeFile(path, "net_prio.ifpriomap", prioMap.CgroupString()); err != nil {
  22. return err
  23. }
  24. }
  25. return nil
  26. }
  27. func (s *NetPrioGroup) Remove(d *cgroupData) error {
  28. return removePath(d.path("net_prio"))
  29. }
  30. func (s *NetPrioGroup) GetStats(path string, stats *cgroups.Stats) error {
  31. return nil
  32. }