*/
int cgroup_get_controller_next(void **handle, struct cgroup_mount_point *info);
int cgroup_get_controller_end(void **handle);
+
+/*
+ * Reads the mount to table to give the mount point of a controller
+ * @controller: Name of the controller
+ * @mount_point: The string where the mount point is stored. Please note,
+ * the caller must free mount_point.
+ */
+int cgroup_get_subsys_mount_point(char *controller, char **mount_point);
+
/* The wrappers for filling libcg structures */
struct cgroup *cgroup_new_cgroup(const char *name);
return 0;
}
+int cgroup_get_subsys_mount_point(char *controller, char **mount_point)
+{
+ int i;
+ int ret = ECGROUPNOTEXIST;
+
+ if (!cgroup_initialized)
+ return ECGROUPNOTINITIALIZED;
+
+ pthread_rwlock_rdlock(&cg_mount_table_lock);
+ for (i = 0; cg_mount_table[i].name[0] != '\0'; i++) {
+ if (strncmp(cg_mount_table[i].name, controller, FILENAME_MAX))
+ continue;
+
+ *mount_point = strdup(cg_mount_table[i].path);
+
+ if (!*mount_point) {
+ last_errno = errno;
+ ret = ECGOTHER;
+ goto out_exit;
+ }
+
+ ret = 0;
+ break;
+ }
+out_exit:
+ pthread_rwlock_unlock(&cg_mount_table_lock);
+ return ret;
+}
cgroup_unload_cgroups;
cgroup_get_controller;
cgroup_get_uid_gid_from_procfs;
+ cgroup_get_subsys_mount_point;
} CGROUP_0.33;
LDADD = $(top_srcdir)/src/.libs/libcgroup.la
# compile the tests, but do not install them
-noinst_PROGRAMS = libcgrouptest01 libcg_ba setuid pathtest walk_test read_stats walk_task get_controller
+noinst_PROGRAMS = libcgrouptest01 libcg_ba setuid pathtest walk_test read_stats walk_task get_controller get_mount_point
libcgrouptest01_SOURCES=libcgrouptest01.c test_functions.c libcgrouptest.h
libcg_ba_SOURCES=libcg_ba.cpp
read_stats_SOURCES=read_stats.c
walk_task_SOURCES=walk_task.c
get_controller_SOURCES=get_controller.c
+get_mount_point_SOURCES=get_mount_point.c
EXTRA_DIST = pathtest.sh runlibcgrouptest.sh