int ret = 0;
proc_mount = fopen("/proc/mounts", "r");
+ if (proc_mount == NULL) {
+ return EIO;
+ }
while ((ent = getmntent(proc_mount)) != NULL) {
if (!strncmp(ent->mnt_fsname,"cgroup", strlen("cgroup"))) {
int error = ECGROUPNOTALLOWED;
strcpy(path, MOUNT_POINT);
- strcat(path,"/tasks");
+ strcat(path,"tasks");
base_tasks = fopen(path, "w");
if (!base_tasks)
goto base_open_err;
cg_build_path(cgroup->name, path);
- strcat(path,"/tasks");
+ strcat(path,"tasks");
delete_tasks = fopen(path, "r");
if (!delete_tasks)
The configuration below creates two classes class1 and class2 and
assigns shares of 1024 to class1 and 512 to class1.
+The other options that can be specified are
+
+tuid = owner of the tasks file
+tgid = group permissions of the tasks file
+cuid = owner of the newly created node
+cgid = group permissions of the newly created node
+
+Example
+
+class1 cpu.shares = 1024 tuid=root tgid=root cuid=database cgid=database.
+
+By default all these files are owned by root. The flexibilty of specifying
+owners makes it easier for other applications to use resource management.
+
Intialization script
--------------------