[CRIU] [PATCH 2/3] cg: allow properties that aren't integers
Tycho Andersen
tycho.andersen at canonical.com
Fri Aug 22 05:49:12 PDT 2014
On Fri, Aug 22, 2014 at 01:10:21PM +0400, Pavel Emelyanov wrote:
> On 08/22/2014 01:00 AM, Tycho Andersen wrote:
> > In particular, cpuset.cpus and cpuset.mems can both be "lists" (strings), as
> > well as hex integers. We don't use the result of this parse, so it is fine to delete it.
> >
> > Signed-off-by: Tycho Andersen <tycho.andersen at canonical.com>
> > ---
> > cgroup.c | 14 +++-----------
> > 1 file changed, 3 insertions(+), 11 deletions(-)
> >
> > diff --git a/cgroup.c b/cgroup.c
> > index c5ae154..b821762 100644
> > --- a/cgroup.c
> > +++ b/cgroup.c
> > @@ -295,12 +295,12 @@ static inline char *strip(char *str)
> > }
> >
> > /*
> > - * Currently this function only supports properties that have 1 value, under 100
> > - * chars
> > + * Currently this function only supports properties that have a string value
> > + * under 1024 chars.
> > */
> > static int read_cgroup_prop(struct cgroup_prop *property, const char *fullpath)
> > {
> > - char buf[100];
> > + char buf[1024];
> > FILE *f;
> > char *endptr;
> >
> > @@ -325,14 +325,6 @@ static int read_cgroup_prop(struct cgroup_prop *property, const char *fullpath)
> > return -1;
> > }
> >
> > - if (strtoll(buf, &endptr, 10) == LLONG_MAX)
> > - strcpy(buf, "-1");
> > -
> > - if (strcmp(endptr, "\n")) {
> > - pr_perror("Failed parsing %s, with strtoll\n", buf);
> > - return -1;
> > - }
>
> This code is required to properly handle the memory controller's unlimited value.
> See commit a152c843b8af67bf8cbb3254a4b50f8e7a8b1104
Ah, whoops. Do we have any idea why the write fails?
I guess we don't need to delete the strtoll test, just the strcmp is
what breaks things.
Tycho
> > -
> > property->value = xstrdup(strip(buf));
> > if (!property->value)
> > return -1;
> >
>
More information about the CRIU
mailing list