]> git.ipfire.org Git - thirdparty/libcgroup.git/commitdiff
wrappers: Add a cgroup_get_cgroup_name API
authorDhaval Giani <dhaval.giani@gmail.com>
Fri, 29 Jun 2012 09:37:38 +0000 (15:07 +0530)
committerDhaval Giani <dhaval.giani@gmail.com>
Thu, 2 Aug 2012 14:52:09 +0000 (10:52 -0400)
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.giani@gmail.com>
Cc: Glauber Costa <glommer@parallels.com>
include/libcgroup/groups.h
src/wrapper.c

index 39596a122712c5cf465ee7f66eba2cd5a2d6f746..7fa42fca7f317c93efa61c222f5c7e91a725f9b8 100644 (file)
@@ -564,6 +564,12 @@ int cgroup_get_procs(char *name, char *controller, pid_t **pids, int *size);
 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);
+
 /**
  * @}
  * @}
index 2d925d2408ee903a210abed26a852f12e48dcb2c..4618005552202d4aeacac6813b2100d19640412f 100644 (file)
@@ -600,3 +600,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;
+}