diff options
author | Balbir Singh <balbir@linux.vnet.ibm.com> | 2009-02-16 13:34:12 +0000 |
---|---|---|
committer | Balbir Singh <balbir@linux.vnet.ibm.com> | 2009-02-16 13:34:12 +0000 |
commit | dedcfa480ee21b9bb87964eb1e2665fe6a200b4c (patch) | |
tree | 61e4516a1f28071d8cb6604f8adb330eb598d3a0 /libcgroup.h | |
parent | b4ca5d9b4a38994aa71fbdb14fd5d65c81bf5216 (diff) | |
download | libcg-dedcfa480ee21b9bb87964eb1e2665fe6a200b4c.tar.gz libcg-dedcfa480ee21b9bb87964eb1e2665fe6a200b4c.tar.xz libcg-dedcfa480ee21b9bb87964eb1e2665fe6a200b4c.zip |
This patch store the last errno value to last_errno value and add
cgroup_add_last_errno procedure to show this number.
Use this procedure to show the cause of the error when ECGOTHER is returned.
[balbir@linux.vnet.ibm.com: fix last_errno in config.c]
Signed-off-by: Ivana Varekova <varekova@redhat.com>
Signed-off-by: Balbir Singh <balbir@linux.vnet.ibm.com>
git-svn-id: https://libcg.svn.sourceforge.net/svnroot/libcg/trunk@329 4f4bb910-9a46-0410-90c8-c897d4f1cd53
Diffstat (limited to 'libcgroup.h')
-rw-r--r-- | libcgroup.h | 13 |
1 files changed, 12 insertions, 1 deletions
diff --git a/libcgroup.h b/libcgroup.h index 37bc888..dee4648 100644 --- a/libcgroup.h +++ b/libcgroup.h @@ -68,6 +68,11 @@ enum cgflags { CGFLAG_USECACHE = 0x01, }; +/** + * per thread errno variable, to be used when return code is ECGOTHER + */ +extern __thread int last_errno; + enum cgroup_errors { ECGROUPNOTCOMPILED=50000, ECGROUPNOTMOUNTED, @@ -88,7 +93,7 @@ enum cgroup_errors { /* Represents error coming from other libraries like glibc. libcgroup * users need to check errno upon encoutering ECGOTHER. */ - ECGOTHER, + ECGOTHER, /* OS error, see errno */ ECGROUPNOTEQUAL, ECGCONTROLLERNOTEQUAL, ECGROUPPARSEFAIL, /* Failed to parse rules configuration file. */ @@ -195,6 +200,12 @@ int cgroup_get_current_controller_path(pid_t pid, const char *controller, */ char *cgroup_strerror(int code); +/** + * Return last errno, which caused ECGOTHER error. + */ +int cgroup_get_last_errno(); + + /* The wrappers for filling libcg structures */ struct cgroup *cgroup_new_cgroup(const char *name); |