summaryrefslogtreecommitdiffstats
path: root/cgconfig.c
diff options
context:
space:
mode:
authorBalbir Singh <balbir@linux.vnet.ibm.com>2008-09-29 12:26:50 +0000
committerBalbir Singh <balbir@linux.vnet.ibm.com>2008-09-29 12:26:50 +0000
commitd1ab753ba5d0d641b52cb90e00ce2eabfae476f4 (patch)
tree984149374ff224629121be769d9e6a4e0eedcf63 /cgconfig.c
parent1d00fc725ba26db40b2c792c75888c2ed777730d (diff)
downloadlibcg-d1ab753ba5d0d641b52cb90e00ce2eabfae476f4.tar.gz
libcg-d1ab753ba5d0d641b52cb90e00ce2eabfae476f4.tar.xz
libcg-d1ab753ba5d0d641b52cb90e00ce2eabfae476f4.zip
Configuration rewrite to use the main cgroups API and several bug fixes
and configuration enhancements. Primarliy Initiated by Dhaval Giani Please see svn log of all branches/balbir-config-cleanup Signed-off-by: Balbir Singh <balbir@linux.vnet.ibm.com> Signed-off-by: Dhaval Giani <dhaval@linux.vnet.ibm.com> git-svn-id: https://libcg.svn.sourceforge.net/svnroot/libcg/trunk@201 4f4bb910-9a46-0410-90c8-c897d4f1cd53
Diffstat (limited to 'cgconfig.c')
-rw-r--r--cgconfig.c55
1 files changed, 55 insertions, 0 deletions
diff --git a/cgconfig.c b/cgconfig.c
new file mode 100644
index 0000000..b98769f
--- /dev/null
+++ b/cgconfig.c
@@ -0,0 +1,55 @@
+
+/*
+ * Copyright IBM Corporation. 2007
+ *
+ * Authors: Dhaval Giani <dhaval@linux.vnet.ibm.com>
+ * Balbir Singh <balbir@linux.vnet.ibm.com>
+ *
+ * This program is free software; you can redistribute it and/or modify it
+ * under the terms of version 2.1 of the GNU Lesser General Public License
+ * as published by the Free Software Foundation.
+ *
+ * This program is distributed in the hope that it would be useful, but
+ * WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
+ *
+ * Code initiated and designed by Dhaval Giani. All faults are most likely
+ * his mistake.
+ */
+
+#include <libcgroup.h>
+#include <libcgroup-internal.h>
+#include <stdio.h>
+#include <stdlib.h>
+#include <string.h>
+
+int main(int argc, char *argv[])
+{
+ int c;
+ char filename[PATH_MAX];
+ int ret;
+
+ if (argc < 2) {
+ fprintf(stderr, "usage is %s <option> <config file>\n",
+ argv[0]);
+ exit(2);
+ }
+
+ while ((c = getopt(argc, argv, "l:")) > 0) {
+ switch (c) {
+ case 'l':
+ strncpy(filename, optarg, PATH_MAX);
+ ret = cgroup_config_load_config(filename);
+ if (ret) {
+ printf("Loading configuration file %s "
+ "failed, ret = %d\n", filename, ret);
+ exit(3);
+ }
+ break;
+ default:
+ fprintf(stderr, "Invalid command line option\n");
+ break;
+ }
+ }
+ return 0;
+}