summaryrefslogtreecommitdiffstats
path: root/include/libcgroup.h
diff options
context:
space:
mode:
authorJan Safranek <jsafrane@redhat.com>2009-07-28 16:08:39 +0200
committerJan Safranek <jsafrane@redhat.com>2009-07-28 16:08:39 +0200
commit9b269475dbc9d9a7527c7ff512bf2a5a0aa493a4 (patch)
treeeee5965cedac513540260b651c1d2d177f2bb6ed /include/libcgroup.h
parent4b198940a8d38da33581ea2eef7c8b05ee103257 (diff)
downloadlibcg-9b269475dbc9d9a7527c7ff512bf2a5a0aa493a4.tar.gz
libcg-9b269475dbc9d9a7527c7ff512bf2a5a0aa493a4.tar.xz
libcg-9b269475dbc9d9a7527c7ff512bf2a5a0aa493a4.zip
Export cgroup_find_parent and add testing code for it
This patch does not necessarily need to be accepted, it just provides testing facility for new cgroup_find_parent. Especially note the ugly dependence on ../src/tools/tools-common.c :) Signed-off-by: Jan Safranek <jsafrane@redhat.com>
Diffstat (limited to 'include/libcgroup.h')
-rw-r--r--include/libcgroup.h12
1 files changed, 12 insertions, 0 deletions
diff --git a/include/libcgroup.h b/include/libcgroup.h
index 3d5660c..0942161 100644
--- a/include/libcgroup.h
+++ b/include/libcgroup.h
@@ -364,6 +364,18 @@ int cgroup_get_controller_end(void **handle);
*/
int cgroup_get_subsys_mount_point(char *controller, char **mount_point);
+/**
+ * Find the parent of the specified directory. It returns the parent (the
+ * parent is usually name/.. unless name is a mount point.
+ *
+ * @param cgroup The cgroup.
+ * @param parent Output, name of parent's group (if the group has parent) or
+ * NULL, if the provided cgroup is the root group and has no parent.
+ * Caller is responsible for freeing the returned string!
+ * @return 0 on success, >0 on error.
+ */
+int cgroup_find_parent(struct cgroup *cgroup, char **parent);
+
/* The wrappers for filling libcg structures */
struct cgroup *cgroup_new_cgroup(const char *name);