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 <[email protected]>
---

 doc/man/cgconfig.conf.5 |   11 ++++++-----
 src/lex.l               |    1 +
 2 files changed, 7 insertions(+), 5 deletions(-)

diff --git a/doc/man/cgconfig.conf.5 b/doc/man/cgconfig.conf.5
index 7aa481f..7f2a219 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 2f4e313..37eb64f 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];}
 %%
 


------------------------------------------------------------------------------
This SF.net email is sponsored by 

Make an app they can't live without
Enter the BlackBerry Developer Challenge
http://p.sf.net/sfu/RIM-dev2dev 
_______________________________________________
Libcg-devel mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/libcg-devel

Reply via email to