----- Original Message ----- > From: "Libo Chen" <clbchenlibo.c...@huawei.com> > To: varek...@redhat.com > Cc: libcg-devel@lists.sourceforge.net, "Wengmeiling" > <wengmeiling.w...@huawei.com>, "Huang Qiang" > huangqi...@huawei.com> > Sent: Friday, August 2, 2013 9:48:41 AM > Subject: [libcg-devel][PATCH] cgsnapshot: fix parse_mountpoints info > > before patch: > #lscgroup > cpu:/ > cpuset:/ > > #cgsnapshot -s cpu > > mount { > cpuset = /cgroup/cpuacct; > cpu = /cgroup/cpu; > } > > We just wanted to save cpu controller, so cpuset was unexpected > > after patch: > #cgsnapshot -s cpu > > mount { > cpu = /cgroup/cpu; > } > > > Signed-off-by: Libo Chen <clbchenlibo.c...@huawei.com>
Hello, I just do some small changes and send second version of this patch which fixes these problems: * if there is no controller, then cgsnapshot should show all mount points * named hierarchies should not be displayed if they are not set as well * update comments http://sourceforge.net/p/libcg/mailman/libcg-devel/thread/20130822093401.31835.24267.stgit%40dhcp-26-101.brq.redhat.com/#msg31315222 Ivana Hutarova > --- > src/tools/cgsnapshot.c | 33 +++++++++++++++++++++++---------- > 1 files changed, 23 insertions(+), 10 deletions(-) > > diff --git a/src/tools/cgsnapshot.c b/src/tools/cgsnapshot.c > index 046c70a..4cd16e8 100644 > --- a/src/tools/cgsnapshot.c > +++ b/src/tools/cgsnapshot.c > @@ -624,6 +624,27 @@ static int show_mountpoints(const char *controller) > return 0; > } > > +static void parse_mountpoint(cont_name_t cont_names[CG_CONTROLLER_MAX], > + struct controller_data *info) > +{ > + int i; > + > + for (i=0; i<=CG_CONTROLLER_MAX-1; i++) { > + if (!strncmp(cont_names[i], info->name, > strlen(info->name)+1)) { > + if(show_mountpoints(info->name)){ > + /* the controller is not mounted */ > + if ((flags & FL_SILENT) == 0) { > + fprintf(stderr, "ERROR: %s hierarchy > " > + "not mounted\n", info->name); > + > + } > + break; > + } > + break; > + } > + } > +} > + > /* print data about input mount points */ > /* TODO only wanted ones */ > static int parse_mountpoints(cont_name_t cont_names[CG_CONTROLLER_MAX], > @@ -642,16 +663,8 @@ static int parse_mountpoints(cont_name_t > cont_names[CG_CONTROLLER_MAX], > while (ret == 0) { > > /* the controller attached to some hierarchy */ > - if (info.hierarchy != 0) { > - ret = show_mountpoints(info.name); > - if (ret != 0) { > - /* the controller is not mounted */ > - if ((flags & FL_SILENT) == 0) { > - fprintf(stderr, "ERROR: %s hierarchy > "\ > - "not mounted\n", info.name); > - } > - } > - } > + if (info.hierarchy != 0) > + parse_mountpoint(cont_names, &info); > > /* next controller */ > ret = cgroup_get_all_controller_next(&handle, &info); > -- > > ------------------------------------------------------------------------------ Introducing Performance Central, a new site from SourceForge and AppDynamics. Performance Central is your source for news, insights, analysis and resources for efficient Application Performance Management. Visit us today! http://pubads.g.doubleclick.net/gampad/clk?id=48897511&iu=/4140/ostg.clktrk _______________________________________________ Libcg-devel mailing list Libcg-devel@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/libcg-devel