summaryrefslogtreecommitdiffstats
path: root/include/libcgroup/error.h
diff options
context:
space:
mode:
authorJan Safranek <jsafrane@redhat.com>2010-03-12 16:50:20 +0100
committerDhaval Giani <dhaval.giani@gmail.com>2010-03-21 22:02:01 +0100
commited0881d91408000d6ea5e4f73b49acf2615df9f9 (patch)
tree86148053ea4208f9299877444283ef89de4a18de /include/libcgroup/error.h
parent4f6e409bad2dfa94a4245f7ea612b91a9baed2b7 (diff)
downloadlibcg-ed0881d91408000d6ea5e4f73b49acf2615df9f9.tar.gz
libcg-ed0881d91408000d6ea5e4f73b49acf2615df9f9.tar.xz
libcg-ed0881d91408000d6ea5e4f73b49acf2615df9f9.zip
Split header file III
Changelog: - since there are no global macros, base.h is gone - since there is no base.h, all headers need to include <features.h> to get __BEGIN_DECLS - new init.h with cgroup_init() and cgroup_get_subsys_mount_point() - new error.h with error handling enum and related stuff - use #ifndef _LIBCGROUP_*_H instead _LIBCG_*_H in header guards - fix few checkpatch complaints (long lines, whitespaces, ...) The patch includes Makefile and .spec changes. I tested it compiles, make dist produces tarball with all headers, so does also the rpm. 'make' should automatically catch all changes in new headers and recompile dependent (=all) sources when any header changes. libcgroup.h - does not declare anything, it just includes all the other files. In future, it might contain base of doxygen documentation (some introduction etc.) libcgroup/error.h - the big enum with errors + error related functions libcgroup/init.h - libcgroup_init() and cgroup_get_subsys_mount_point() libcgroup/config.h - configuration reading/unloading libcgroup/groups.h - group manipulation stuff (create/modify/delete/free, incl. controllers and get/set values) + definition of struct cgroup (=must be included by libcgroup/tasks.h, which needs it) libcgroup/iterators.h - various walks, *_begin/next/end libcgroup/tasks.h - task classification, incl. rules cache manipulation In addition, I probably removed some #includes, which are not needed now when looking for the minimal #include set to build the project. I also hope I did not miss any function declaration or macro... Signed-off-by: Jan Safranek <jsafrane@redhat.com> Signed-off-by: Dhaval Giani <dhaval.giani@gmail.com>
Diffstat (limited to 'include/libcgroup/error.h')
-rw-r--r--include/libcgroup/error.h58
1 files changed, 58 insertions, 0 deletions
diff --git a/include/libcgroup/error.h b/include/libcgroup/error.h
new file mode 100644
index 0000000..4d756ff
--- /dev/null
+++ b/include/libcgroup/error.h
@@ -0,0 +1,58 @@
+#ifndef _LIBCGROUP_ERROR_H
+#define _LIBCGROUP_ERROR_H
+
+#include <features.h>
+
+__BEGIN_DECLS
+
+enum {
+ ECGROUPNOTCOMPILED = 50000,
+ ECGROUPNOTMOUNTED,
+ ECGROUPNOTEXIST,
+ ECGROUPNOTCREATED,
+ ECGROUPSUBSYSNOTMOUNTED,
+ ECGROUPNOTOWNER,
+ ECGROUPMULTIMOUNTED,/* Controllers bound to different mount points */
+ ECGROUPNOTALLOWED, /* This is the stock error. Default error. */
+ ECGMAXVALUESEXCEEDED,
+ ECGCONTROLLEREXISTS,
+ ECGVALUEEXISTS,
+ ECGINVAL,
+ ECGCONTROLLERCREATEFAILED,
+ ECGFAIL,
+ ECGROUPNOTINITIALIZED,
+ ECGROUPVALUENOTEXIST,
+ /* Represents error coming from other libraries like glibc. libcgroup
+ * users need to check errno upon encoutering ECGOTHER.
+ */
+ ECGOTHER, /* OS error, see errno */
+ ECGROUPNOTEQUAL,
+ ECGCONTROLLERNOTEQUAL,
+ ECGROUPPARSEFAIL, /* Failed to parse rules configuration file. */
+ ECGROUPNORULES, /* Rules list does not exist. */
+ ECGMOUNTFAIL,
+ ECGSENTINEL, /* Please insert further error codes above this */
+ ECGEOF, /* End of file, iterator */
+ ECGCONFIGPARSEFAIL,/* Failed to parse config file (cgconfig.conf). */
+ ECGNAMESPACEPATHS,
+ ECGNAMESPACECONTROLLER,
+ ECGMOUNTNAMESPACE,
+};
+
+#define ECGRULESPARSEFAIL ECGROUPPARSEFAIL
+
+/**
+ * Return error corresponding to @code in human readable format.
+ * @code: error code for which the corresponding error string is to be
+ * returned
+ */
+const char *cgroup_strerror(int code);
+
+/**
+ * Return last errno, which caused ECGOTHER error.
+ */
+int cgroup_get_last_errno();
+
+__END_DECLS
+
+#endif /* _LIBCGROUP_INIT_H */