From d712d29b9af224a8e5495c01c0ce6e9c322e3588 Mon Sep 17 00:00:00 2001 From: Rohit Jnagal Date: Tue, 8 Jul 2014 18:49:45 +0000 Subject: [PATCH] Add a cleanup method to cgroup fs. This will help in building a standalone cgroup test util. systemd does auto cleanup on empty, so doesn't need an extra interface. Docker-DCO-1.1-Signed-off-by: Rohit Jnagal (github: rjnagal) --- cgroups/fs/apply_raw.go | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/cgroups/fs/apply_raw.go b/cgroups/fs/apply_raw.go index 8fa34c21..b4ee668c 100644 --- a/cgroups/fs/apply_raw.go +++ b/cgroups/fs/apply_raw.go @@ -52,6 +52,14 @@ func Apply(c *cgroups.Cgroup, pid int) (cgroups.ActiveCgroup, error) { return d, nil } +func Cleanup(c *cgroups.Cgroup) error { + d, err := getCgroupData(c, 0) + if err != nil { + return fmt.Errorf("Could not get Cgroup data %s", err) + } + return d.Cleanup() +} + func GetStats(c *cgroups.Cgroup) (*cgroups.Stats, error) { stats := cgroups.NewStats()