summaryrefslogtreecommitdiffstats
path: root/tests/get_controller.c
diff options
context:
space:
mode:
Diffstat (limited to 'tests/get_controller.c')
-rw-r--r--tests/get_controller.c34
1 files changed, 34 insertions, 0 deletions
diff --git a/tests/get_controller.c b/tests/get_controller.c
new file mode 100644
index 0000000..1829f5c
--- /dev/null
+++ b/tests/get_controller.c
@@ -0,0 +1,34 @@
+#include <libcgroup.h>
+#include <stdio.h>
+#include <stdlib.h>
+
+int main()
+{
+ int error;
+ void *handle;
+ struct cgroup_mount_point info;
+
+ error = cgroup_init();
+
+ if (error) {
+ printf("cgroup_init failed with %s\n", cgroup_strerror(error));
+ exit(1);
+ }
+
+ error = cgroup_get_controller_begin(&handle, &info);
+
+ while (error != ECGEOF) {
+ printf("Controller %s is mounted at %s\n", info.name,
+ info.path);
+ error = cgroup_get_controller_next(&handle, &info);
+ if (error && error != ECGEOF) {
+ printf("cgroup_get_contrller_next failed with %s",
+ cgroup_strerror(error));
+ exit(1);
+ }
+ }
+
+ error = cgroup_get_controller_end(&handle);
+
+ return 0;
+}