diff tests/container_count.c @ 7:8339ab15527d

Add running/stopped containers global statistics and refactor some things
author Louis Opter <louis@dotcloud.com>
date Sat, 01 Jan 2011 17:46:40 +0100
parents
children
line wrap: on
line diff
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/tests/container_count.c	Sat Jan 01 17:46:40 2011 +0100
@@ -0,0 +1,30 @@
+#include <sys/types.h>
+
+#include <err.h>
+#include <stdio.h>
+#include <stdlib.h>
+
+#include "lxcstats.h"
+#include "_lxcstats.h"
+
+int
+main(int argc, char *argv[])
+{
+    lxcst_handle    *hdl;
+    int             count;
+
+    hdl = lxcst_open();
+    if (!hdl)
+        err(EXIT_FAILURE, "lxcst_open failed");
+
+    count = _lxcst_container_count(hdl);
+    if (count == -1)
+        err(EXIT_FAILURE, "_lxcst_container_count failed");
+
+    printf("%s: %d containers.\n", *argv, count);
+
+    lxcst_close(hdl);
+
+    return (EXIT_SUCCESS);
+    (void)argc;
+}