We had no way of getting the name from the cgroup structure. We
have enough users who do want this information. Provide an API
to do so.

Signed-off-by: Dhaval Giani <dhaval.gi...@gmail.com>
Cc: Glauber Costa <glom...@parallels.com>

diff --git a/include/libcgroup/groups.h b/include/libcgroup/groups.h
index 39596a1..7fa42fc 100644
--- a/include/libcgroup/groups.h
+++ b/include/libcgroup/groups.h
@@ -565,6 +565,12 @@ int cg_chmod_recursive(struct cgroup *cgroup, mode_t 
dir_mode,
        int dirm_change, mode_t file_mode, int filem_change);
 
 /**
+ *  Get the name of the cgroup from a given cgroup
+ *  @param cgroup The cgroup whose name is needed
+ */
+char *cgroup_get_cgroup_name(struct cgroup *cgroup);
+
+/**
  * @}
  * @}
  */
diff --git a/src/wrapper.c b/src/wrapper.c
index 50b8013..f1eec77 100644
--- a/src/wrapper.c
+++ b/src/wrapper.c
@@ -595,3 +595,10 @@ char *cgroup_get_value_name(struct cgroup_controller 
*controller, int index)
                return NULL;
 }
 
+char *cgroup_get_cgroup_name(struct cgroup *cgroup)
+{
+       if (!cgroup)
+               return NULL;
+
+       return cgroup->name;
+}



------------------------------------------------------------------------------
Live Security Virtual Conference
Exclusive live event will cover all the ways today's security and 
threat landscape has changed and how IT managers can respond. Discussions 
will include endpoint security, mobile security and the latest in malware 
threats. http://www.accelacomm.com/jaw/sfrnl04242012/114/50122263/
_______________________________________________
Libcg-devel mailing list
Libcg-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/libcg-devel

Reply via email to