1 diff -ur libcgroup-0.37/doc/man/cgconfig.conf.5 libcgroup-0.37-mode/doc/man/cgconfig.conf.5
2 --- libcgroup-0.37/doc/man/cgconfig.conf.5 2010-12-07 16:42:41.000000000 +0100
3 +++ libcgroup-0.37-mode/doc/man/cgconfig.conf.5 2011-02-09 19:11:47.076601002 +0100
15 +dmode = <admin directory mode>;
16 +fmode = <admin files mode>;
21 file of the control group. I.e. this user and members of this
22 group has write access to the file.
25 +Permission mode of \fItasks\fR file of the control group.
26 +The mode have to be set using octal numbers e.g. 640.
29 Name of the user and the group, which owns the rest of control group's
30 files. These users are allowed to set subsystem
31 parameters and create subgroups.
33 +.B "admin dmode/fmode"
34 +Permission mode of control group's directory (\fIdmode\fR) and files
35 +(\fIfmode\fR). The mode have to be set using octal numbers e.g. 775
36 +for \fIdmode\fR and 664 for \fIfmode\fR.
38 Permissions are related only to enclosing control group and are not
39 inherited by subgroups. If there is no
40 diff -ur libcgroup-0.37/src/api.c libcgroup-0.37-mode/src/api.c
41 --- libcgroup-0.37/src/api.c 2010-12-07 16:42:41.000000000 +0100
42 +++ libcgroup-0.37-mode/src/api.c 2011-02-09 18:57:25.455591513 +0100
43 @@ -1409,6 +1409,10 @@
44 cgroup_dbg("Changing ownership of %s\n", fts_path[0]);
45 error = cg_chown_recursive(fts_path,
46 cgroup->control_uid, cgroup->control_gid);
48 + error = cg_chmod_recursive(cgroup,
49 + cgroup->control_dmode, cgroup->control_dmode,
50 + cgroup->control_fmode, cgroup->control_fmode);
54 @@ -1458,6 +1462,13 @@
60 + if (cgroup->tasks_mode != 0)
61 + error = chmod(path, cgroup->tasks_mode);
68 diff -ur libcgroup-0.37/src/config.c libcgroup-0.37-mode/src/config.c
69 --- libcgroup-0.37/src/config.c 2010-12-07 16:42:41.000000000 +0100
70 +++ libcgroup-0.37-mode/src/config.c 2011-02-09 18:59:15.330591502 +0100
73 config_cgroup->tasks_gid = val;
75 + if (!strcmp(perm_type, "mode")) {
76 + /* allowed mode strings are octal version: "755" */
78 + int pos = 0; /* position of the number iin string */
83 + if (value[pos] < '0' || value[pos] >= '8')
84 + goto group_task_error;
85 + i = (int)value[pos] - (int)'0';
86 + /* parse the permission triple*/
92 + /* the string have to contain three characters */
93 + if (value[pos] != '\0')
94 + goto group_task_error;
96 + config_cgroup->tasks_mode = mode;
103 config_cgroup->control_gid = val;
105 + if (!strcmp(perm_type, "dmode")) {
106 + /* allowed mode strings are octal version: "755" */
108 + int pos = 0; /* position of the number iin string */
113 + if (value[pos] < '0' || value[pos] >= '8')
115 + i = (int)value[pos] - (int)'0';
116 + /* parse the permission triple*/
122 + /* the string have to contain three characters */
123 + if (value[pos] != '\0')
126 + config_cgroup->control_dmode = mode;
128 + if (!strcmp(perm_type, "fmode")) {
129 + /* allowed mode strings are octal version: "755" */
131 + int pos = 0; /* position of the number iin string */
136 + if (value[pos] < '0' || value[pos] >= '8')
138 + i = (int)value[pos] - (int)'0';
139 + /* parse the permission triple*/
145 + /* the string have to contain three characters */
146 + if (value[pos] != '\0')
149 + config_cgroup->control_fmode = mode;
154 diff -ur libcgroup-0.37/src/libcgroup-internal.h libcgroup-0.37-mode/src/libcgroup-internal.h
155 --- libcgroup-0.37/src/libcgroup-internal.h 2010-10-20 15:59:13.000000000 +0200
156 +++ libcgroup-0.37-mode/src/libcgroup-internal.h 2011-02-09 19:14:13.803601030 +0100
164 + mode_t control_dmode;
165 + mode_t control_fmode;