[CRIU] [PATCH] Attempt to restore cgroups

Tycho Andersen tycho.andersen at canonical.com
Wed Jul 2 11:45:03 PDT 2014


Hi Pavel,

On Wed, Jul 02, 2014 at 12:12:10AM +0400, Pavel Emelyanov wrote:
> > +{
> > +	struct cgroup_dir *cur;
> > +	CgroupDirEntry *cde;
> > +	void *m;
> > +	int i = 0;
> > +
> > +	m = xmalloc(n_dirs * (sizeof(CgroupDirEntry *) + sizeof(CgroupDirEntry)));
> > +	*ents = m;
> > +	if (!m)
> > +		return -1;
> > +
> > +	cde = m + n_dirs * sizeof(CgroupDirEntry *);
> 
> Just for the record -- we have the xptr_pull() helper that can help putting
> objects one-by-one in the single-malloc-ed memory segment. You can find the
> good (I hope)  example of it in the core_entry_alloc().

So after playing with this for a bit it isn't entirely clear how I can
condense the code using xptr_pull. The implementation above is one I
copied from dump_sets(), which has the same protobuf type problem.

I have the rest of the changes suggested in this thread prepared, so I
can post those or if you can clarify xptr_pull, I can make this change
as well.

Thanks,

Tycho


More information about the CRIU mailing list