]> git.ipfire.org Git - thirdparty/libcgroup.git/commitdiff
Some parameters (like devices.allow) shall include a space in their values.
authorJan Safranek <jsafrane@redhat.com>
Tue, 10 Aug 2010 09:38:14 +0000 (15:08 +0530)
committerBalbir Singh <balbir@linux.vnet.ibm.com>
Tue, 10 Aug 2010 09:38:14 +0000 (15:08 +0530)
This patch adds possibility to specify parameters names in double quotes,
like:
devices {
devices.allow="c 1:3 mr";
}

The double quotes are not mandatory, old  behavior is still there.

As side effect, also parameter names, group names, user names, controller names
etc. can be (optionally) in double quotes and can contain weird characters
- it's a feature, not a bug :). Of course, I could change the grammar to allow
double quotes only in param. values, that shouldn't be a problem.

There is also no advance handling of escape sequences - \", \n, \t does not work
here. That means that parameter values cannot contain newline or double quote
characters - are they required by any controllers?

Signed-off-by: Jan Safranek <jsafrane@redhat.com>
Signed-off-by: Balbir Singh <balbir@linux.vnet.ibm.com>
doc/man/cgconfig.conf.5
src/lex.l

index 7aa481f4ed90caa9f0c3f45695f3998abe58e300..7f2a219a2796f8460498ee5ae210dbcfc66b0b98 100644 (file)
@@ -169,7 +169,8 @@ parameters.
 .TP
 .B param value
 Value, which should be written to the file when the control group is
-created.
+created. Optionally it can be enclosed in double quotes `"', it can
+contain spaces then.
 .RE
 
 .\"********************************************"
@@ -233,7 +234,7 @@ gid = root;
 }
 cpu {
 .RS
-cpu.shares = 1000;
+cpu.shares = "1000";
 .RE
 }
 .RE
@@ -259,7 +260,7 @@ gid = root;
 }
 cpu {
 .RS
-cpu.shares = 500;
+cpu.shares = "500";
 .RE
 }
 .RE
@@ -379,7 +380,7 @@ group daemons/www {
 .RS
 cpu {
 .RS
-cpu.shares = 1000;
+cpu.shares = "1000";
 .RE
 }
 .RE
@@ -389,7 +390,7 @@ group daemons/ftp {
 .RS
 cpu {
 .RS
-cpu.shares = 500;
+cpu.shares = "500";
 .RE
 }
 .RE
index 2f4e3132f06d39456e7f23f31bb677c0b8722e48..37eb64f4d81576116e2a64878105a49119057997 100644 (file)
--- a/src/lex.l
+++ b/src/lex.l
@@ -33,6 +33,7 @@ int line_no = 1;
 "group"                {return GROUP;}
 "namespace"    {return NAMESPACE;}
 [a-zA-Z0-9_\-\/\.]+ {yylval.name = strdup(yytext); return ID;}
+\"[^"]+\" {yylval.name = strdup(yytext+1); yylval.name[strlen(yylval.name)-1] = '\0'; return ID; }
 .      {return yytext[0];}
 %%