[CRIU] [PATCH] cgroups: get controllers from /proc/self/cgroups (v2)

Cyrill Gorcunov gorcunov at gmail.com
Fri Sep 11 08:47:56 PDT 2015


On Fri, Sep 11, 2015 at 06:45:46PM +0300, Cyrill Gorcunov wrote:
> On Fri, Sep 11, 2015 at 06:35:46PM +0300, Andrey Vagin wrote:
> > Some controllers can be disabled in kernel options. In this case they
> > are shown in /proc/cgroups, but they could not be mounted.
> > 
> > All enabled controllers can be collected from /proc/self/cgroup.
> > 
> > https://github.com/xemul/criu/issues/28
> > 
> > v2: ',' is used to separate controllers
> > 
> > Cc: Tycho Andersen <tycho.andersen at canonical.com>
> > Reported-by: Ross Boucher <boucher at gmail.com>
> > Signed-off-by: Andrey Vagin <avagin at openvz.org>
> >  
> 
> Could you please explain why can't you test the "active"
> field from /proc/cgroups and simply skip the controller
> if it's disabled?

I mean

	while (fgets(buf, 1024, f)) {
		char *n;
		char found = 0;
		int tmp, enabled;

		if (sscanf(buf, "%s %d %d %d", name, &hierarchy_id, &tmp, &enabled) != 4) {
			pr_err("Unable to parse: %s\n", buf);
			goto out;
		}
		if (!enabled)
			continue;
		...

	Cyrill


More information about the CRIU mailing list