diff options
-rw-r--r-- | include/libcgroup.h | 16 | ||||
-rw-r--r-- | src/libcgroup.map | 2 | ||||
-rw-r--r-- | src/wrapper.c | 24 |
3 files changed, 42 insertions, 0 deletions
diff --git a/include/libcgroup.h b/include/libcgroup.h index d54d9c6..ce75d2e 100644 --- a/include/libcgroup.h +++ b/include/libcgroup.h @@ -469,6 +469,22 @@ int cgroup_set_value_bool(struct cgroup_controller *controller, const char *name, bool value); struct cgroup_controller *cgroup_get_controller(struct cgroup *cgroup, const char *name); + +/** + * Return the number of variables for the specified controller, if the + * structure does not exist -1 is returned + * @param controller Name of the controller for which stats are requested. + */ +int cgroup_get_value_name_count(struct cgroup_controller *controller); + +/** + * Return the "index" variable for the specified controller, + * the return value is the pointer to the internal structure so + * don't dealocate it, or change the content of the memory space. + * @param controller Name of the controller for which stats are requested. + * @param index number of the variable. + */ +char *cgroup_get_value_name(struct cgroup_controller *controller, int index); /* * Config related stuff */ diff --git a/src/libcgroup.map b/src/libcgroup.map index 87d8a51..06c5e07 100644 --- a/src/libcgroup.map +++ b/src/libcgroup.map @@ -82,4 +82,6 @@ global: cgroup_get_all_controller_begin; cgroup_get_all_controller_next; cgroup_get_all_controller_end; + cgroup_get_value_name_count; + cgroup_get_value_name; } CGROUP_0.34; diff --git a/src/wrapper.c b/src/wrapper.c index c82ffbf..53d70a9 100644 --- a/src/wrapper.c +++ b/src/wrapper.c @@ -612,3 +612,27 @@ scgroup_err: cgroup_free(&src_cgroup); return NULL; } + +int cgroup_get_value_name_count(struct cgroup_controller *controller) +{ + int ret; + + if (!controller) + return -1; + + return controller->index; +} + + +char *cgroup_get_value_name(struct cgroup_controller *controller, int index) +{ + + if (!controller) + return NULL; + + if (index < controller->index) + return (controller->values[index])->name; + else + return NULL; +} + |