summaryrefslogtreecommitdiffstats
path: root/libcgroup.h
diff options
context:
space:
mode:
authorBalbir Singh <balbir@linux.vnet.ibm.com>2008-08-22 16:44:17 +0000
committerBalbir Singh <balbir@linux.vnet.ibm.com>2008-08-22 16:44:17 +0000
commit2124f1ea16bcc12482928c45689c1fa4d92a74a1 (patch)
treee5e51d88f8907e8d38b70b327f4d7a387b74b4b7 /libcgroup.h
parent3efa319b43fb1f66a96e5001c9e5cba51f854370 (diff)
downloadlibcg-2124f1ea16bcc12482928c45689c1fa4d92a74a1.tar.gz
libcg-2124f1ea16bcc12482928c45689c1fa4d92a74a1.tar.xz
libcg-2124f1ea16bcc12482928c45689c1fa4d92a74a1.zip
This patch adds cgroup_create_cgroup_from_parent() API. I've tested it
with a modified version of libcg_ba (basic acceptance tests), that I'll send out later. I've also fixed a couple of bugs, I'll list them in order and if desired, I'll split out the patches so that the enhancements can be separate from the bug fixes 1. Fix cg_create_control_group() to succeed if the directory already exists 2. We can't always append a control_file, we need to open it "r+" 3. It's OK for writing values to a control_file to fail, since some of them are read-only and some may not exist in hierarchies below the root 4. Skip over directories while trying to read control file's name value pairs 5. In cg_rd_ctlr_file we don't allocate any memory to value, directly fscanf into it, that's been fixed 6. There might be more fixes that might already be present in trunk, since I hope I've not redone a lot of the fixes, I had branched of trunk very recently Changelog v2 ------------ 1. Refactor cgroup_free_controllers() and use it in cgroup_create_cgroup_from_parent() 2. Check for strdup failure 3. Check if dst == src TODO: 1. Use cg_add_controller() API 2. Use cg_add_value_string() API I'll send out patches for the TODOs later. I've also updated the basic acceptance test (libcg_ba.cpp) Signed-off-by: Balbir Singh <balbir@linux.vnet.ibm.com> git-svn-id: https://libcg.svn.sourceforge.net/svnroot/libcg/trunk@165 4f4bb910-9a46-0410-90c8-c897d4f1cd53
Diffstat (limited to 'libcgroup.h')
-rw-r--r--libcgroup.h3
1 files changed, 3 insertions, 0 deletions
diff --git a/libcgroup.h b/libcgroup.h
index 8eeb1a7..dc7e23f 100644
--- a/libcgroup.h
+++ b/libcgroup.h
@@ -172,6 +172,8 @@ int cgroup_create_cgroup(struct cgroup *cgroup, int ignore_ownership);
int cgroup_delete_cgroup(struct cgroup *cgroup, int ignore_migration);
int cgroup_attach_task_pid(struct cgroup *cgroup, pid_t tid);
struct cgroup *cgroup_get_cgroup(struct cgroup *cgroup);
+int cgroup_create_cgroup_from_parent(struct cgroup *cgroup, int ignore_ownership);
+int cgroup_copy_cgroup(struct cgroup *dst, struct cgroup *src);
/* Changes the cgroup of calling application based on rule file */
int cgroup_change_cgroup_uid_gid(uid_t uid, gid_t gid, pid_t pid);
@@ -183,6 +185,7 @@ struct cgroup *cgroup_new_cgroup(const char *name);
struct cgroup_controller *cgroup_add_controller(struct cgroup *cgroup,
const char *name);
void cgroup_free(struct cgroup **cgroup);
+void cgroup_free_controllers(struct cgroup *cgroup);
int cgroup_add_value_string(struct cgroup_controller *controller,
const char *name, const char *value);
int cgroup_add_value_int64(struct cgroup_controller *controller,