github.com/opencontainers/runc@v1.2.0-rc.1.0.20240520010911-492dc558cdd6/libcontainer/cgroups/fs/net_cls.go (about) 1 package fs 2 3 import ( 4 "strconv" 5 6 "github.com/opencontainers/runc/libcontainer/cgroups" 7 "github.com/opencontainers/runc/libcontainer/configs" 8 ) 9 10 type NetClsGroup struct{} 11 12 func (s *NetClsGroup) Name() string { 13 return "net_cls" 14 } 15 16 func (s *NetClsGroup) Apply(path string, _ *configs.Resources, pid int) error { 17 return apply(path, pid) 18 } 19 20 func (s *NetClsGroup) Set(path string, r *configs.Resources) error { 21 if r.NetClsClassid != 0 { 22 if err := cgroups.WriteFile(path, "net_cls.classid", strconv.FormatUint(uint64(r.NetClsClassid), 10)); err != nil { 23 return err 24 } 25 } 26 27 return nil 28 } 29 30 func (s *NetClsGroup) GetStats(path string, stats *cgroups.Stats) error { 31 return nil 32 }