From: Jan Safranek Date: Tue, 10 Aug 2010 09:38:14 +0000 (+0530) Subject: Some parameters (like devices.allow) shall include a space in their values. X-Git-Tag: v0.37.1~53^2 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=22d260d2f3cf11e355bf404769f6d087d9e96acd;p=thirdparty%2Flibcgroup.git Some parameters (like devices.allow) shall include a space in their values. 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 Signed-off-by: Balbir Singh --- diff --git a/doc/man/cgconfig.conf.5 b/doc/man/cgconfig.conf.5 index 7aa481f4..7f2a219a 100644 --- a/doc/man/cgconfig.conf.5 +++ b/doc/man/cgconfig.conf.5 @@ -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 diff --git a/src/lex.l b/src/lex.l index 2f4e3132..37eb64f4 100644 --- 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];} %%