2
* Copyright IBM Corporation. 2007
4
* Authors: Balbir Singh <balbir@linux.vnet.ibm.com>
5
* This program is free software; you can redistribute it and/or modify it
6
* under the terms of version 2.1 of the GNU Lesser General Public License
7
* as published by the Free Software Foundation.
9
* This program is distributed in the hope that it would be useful, but
10
* WITHOUT ANY WARRANTY; without even the implied warranty of
11
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
13
* NOTE: The grammar has been modified, not to be the most efficient, but
14
* to allow easy updation of internal data structures.
20
#include <libcgroup.h>
21
#include <libcgroup-internal.h>
29
fprintf(stderr, "error at line number %d at %c:%s", line_no, *yytext,
40
%token ID MOUNT GROUP PERM TASK ADMIN
47
%type <name> ID namevalue_conf
48
%type <val> mountvalue_conf mount task_namevalue_conf admin_namevalue_conf
49
%type <val> admin_conf task_conf task_or_admin group_conf group start
67
group : GROUP ID '{' group_conf '}'
71
cgroup_config_insert_cgroup($2);
73
fprintf(stderr, "parsing failed at line number %d\n",
82
: ID '{' namevalue_conf '}'
84
$$ = cgroup_config_parse_controller_options($1, $3);
86
fprintf(stderr, "parsing failed at line number %d\n",
92
| group_conf ID '{' namevalue_conf '}'
94
$$ = cgroup_config_parse_controller_options($2, $4);
96
fprintf(stderr, "parsing failed at line number %d\n",
102
| PERM '{' task_or_admin '}'
106
fprintf(stderr, "parsing failed at line number %d\n",
117
$1 = realloc($1, strlen($1) + strlen($3) + 2);
118
$1 = strncat($1, " ", strlen(" "));
119
$$ = strncat($1, $3, strlen($3));
122
| namevalue_conf ID '=' ID ';'
127
$2 = realloc($2, len + strlen($2) + strlen($4) + 3);
128
$2 = strncat($2, " ", strlen(" "));
129
$$ = strncat($2, $4, strlen($4));
131
$2 = strncat($2, ":", strlen(":"));
132
$$ = strncat($2, $1, strlen($1));
145
$$ = cgroup_config_group_task_perm($1, $3);
147
fprintf(stderr, "parsing failed at line number %d\n",
153
| task_namevalue_conf ID '=' ID ';'
155
$$ = $1 && cgroup_config_group_task_perm($2, $4);
157
fprintf(stderr, "parsing failed at line number %d\n",
168
$$ = cgroup_config_group_admin_perm($1, $3);
170
fprintf(stderr, "parsing failed at line number %d\n",
176
| admin_namevalue_conf ID '=' ID ';'
178
$$ = $1 && cgroup_config_group_admin_perm($2, $4);
180
fprintf(stderr, "parsing failed at line number %d\n",
189
: TASK '{' task_namevalue_conf '}' admin_conf
193
fprintf(stderr, "parsing failed at line number %d\n",
199
| ADMIN '{' admin_namevalue_conf '}' task_conf
203
fprintf(stderr, "parsing failed at line number %d\n",
211
admin_conf: ADMIN '{' admin_namevalue_conf '}'
215
fprintf(stderr, "parsing failed at line number %d\n",
223
task_conf: TASK '{' task_namevalue_conf '}'
227
fprintf(stderr, "parsing failed at line number %d\n",
238
if (!cgroup_config_insert_into_mount_table($1, $3)) {
239
cgroup_config_cleanup_mount_table();
245
| mountvalue_conf ID '=' ID ';'
247
if (!cgroup_config_insert_into_mount_table($2, $4)) {
248
cgroup_config_cleanup_mount_table();
256
mount : MOUNT '{' mountvalue_conf '}'
260
fprintf(stderr, "parsing failed at line number %d\n",