From: Weng Meiling <wengmeiling.w...@huawei.com> Any line starting with '#' in cgconfig.conf is considered a comment and is ignored. But in cgrules.conf, no matter where the character '#' is, it will be replace with '\0'. So the similar rules get different results as following:
the rule: *% cpu test all process will go to cpu's test cgroup, but thr rule: *# cpu test the cgred service will start fail. Is it necessary to unify the meaning of character '#' in cgconfig.conf and cgrules? Can we fix this like the patch or modify the parsing method of cgconfig.conf to use the '#' as comment tag no matter where it is? Signed-off-by: Weng Meiling <wengmeiling.w...@huawei.com> --- src/api.c | 7 ++++++- 1 files changed, 6 insertions(+), 1 deletions(-) diff --git a/src/api.c b/src/api.c index e5e1959..ddd7871 100644 --- a/src/api.c +++ b/src/api.c @@ -441,10 +441,15 @@ static void cgroup_free_rule_list(struct cgroup_rule_list *cg_rl) static char *cg_skip_unused_charactors_in_rule(char *rule) { char *itr; + char *first_letter; /* We ignore anything after a # sign as comments. */ itr = strchr(rule, '#'); - if (itr) + first_letter = rule; + while (first_letter && isblank(*first_letter)) + first_letter++; + + if (itr && (itr == rule)) *itr = '\0'; /* We also need to remove the newline character. */ -- 1.7.1 ------------------------------------------------------------------------------ Get 100% visibility into Java/.NET code with AppDynamics Lite! It's a free troubleshooting tool designed for production. Get down to code-level detail for bottlenecks, with <2% overhead. Download for free and get started troubleshooting in minutes. http://pubads.g.doubleclick.net/gampad/clk?id=48897031&iu=/4140/ostg.clktrk _______________________________________________ Libcg-devel mailing list Libcg-devel@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/libcg-devel