[CRIU] [PATCH 1/2] Re-create cgroups if necessary
Andrew Vagin
avagin at parallels.com
Tue Jun 24 00:10:44 PDT 2014
On Tue, Jun 24, 2014 at 10:58:04AM +0400, Pavel Emelyanov wrote:
> On 06/24/2014 10:07 AM, Andrew Vagin wrote:
> > On Mon, Jun 23, 2014 at 11:28:27PM -0500, Tycho Andersen wrote:
> >> On Tue, Jun 24, 2014 at 08:03:25AM +0400, Andrew Vagin wrote:
> >>> On Tue, Jun 24, 2014 at 02:29:27AM +0000, Tycho Andersen wrote:
> >>>> On Mon, Jun 23, 2014 at 10:53:48PM +0400, Andrew Vagin wrote:
> >>>>>
> >>>>> Look at my version. It doesn't copy a path in another place.
> >>>>
> >>>> The copy is sort of unfortunate, strtok writes a null byte to the
> >>>> string it is tokenizing, which seems impolite to do as callers won't
> >>>> expect it, even though it might not break anything. I used it because
> >>>> I prefer using library functions to rolling my own, but I'm happy to
> >>>> switch it if the copy is a big issue.
> >>>>
> >>>> Tycho
> >>>>
> >>>
> >>> The copy isn't a big issue. I don't like strtok:).
> >>
> >> That's fair :-)
> >>
> >>> Below you can find a version, which don't modify path in place.
> >>
> >> It still does modify the string, though, which means you can't pass
> >
> > No, it doesn't. It creates a copy in made_path and does that for one
> > call and then it modifies this copy.
> >
> >> read-only memory to mkdirpat, which might also be a little surprising.
> >> Maybe this version with a copy?
> >
> > It's up to Pavel.
>
> I think that the library function shouldn't corrupt the string it takes.
> And since we don't have read-only memory (yet) it's OK if we modify
> the string in place, then restore it back.
>
> But, since cgroup paths are typically short, copying it to another place
> doesn't cost much. Thus the simpler code we have, the better it is :)
so you have two version of code. Pls open both and choose one of them.
Thanks.
>
> Thanks,
> Pavel
>
More information about the CRIU
mailing list