From 6c98d930e3cd870428a6f76bed3c0443c9da92ef Mon Sep 17 00:00:00 2001 From: Ivana Hutarova Varekova Date: Wed, 18 Aug 2010 11:22:54 +0200 Subject: [PATCH] Change the return value to more informative one Change the return value to more informative one the previous error message: # /sbin/cgconfigparser -l /tmp/cgconfig.conf can't create group "CBSFxx/Zcz6": Loading configuration file /etc/cgconfig.conf failed Cgroup values are not equal the new error message #/sbin/cgconfigparser -l /etc/cgconfig.conf can't create group "CBSFxx/Zcz6": Loading configuration file /etc/cgconfig.conf failed Value setting does not succeed Signed-off-by: Ivana Hutarova Varekova Signed-off-by: Jan Safranek --- include/libcgroup/error.h | 1 + src/api.c | 7 ++++--- 2 files changed, 5 insertions(+), 3 deletions(-) diff --git a/include/libcgroup/error.h b/include/libcgroup/error.h index 908845ee..5d20537a 100644 --- a/include/libcgroup/error.h +++ b/include/libcgroup/error.h @@ -72,6 +72,7 @@ enum { ECGNAMESPACECONTROLLER, ECGMOUNTNAMESPACE, ECGROUPUNSUPP, + ECGCANTSETVALUE, }; /** diff --git a/src/api.c b/src/api.c index 4bd6b463..492fb515 100644 --- a/src/api.c +++ b/src/api.c @@ -117,6 +117,7 @@ const char const *cgroup_strerror_codes[] = { "Controller in namespace does not exist", "Cannot have mount and namespace keyword in the same configuration file", "This kernel does not support this feature", + "Value setting does not succeed", }; static int cg_chown_file(FTS *fts, FTSENT *ent, uid_t owner, gid_t group) @@ -1311,7 +1312,7 @@ err: * * returns 0 on success. We recommend calling cg_delete_cgroup * if this routine fails. That should do the cleanup operation. - * If ECGROUPNOTEQUAL is returned, the group was created successfully + * If ECGCANTSETVALUE is returned, the group was created successfully * but not all controller parameters were successfully set. */ int cgroup_create_cgroup(struct cgroup *cgroup, int ignore_ownership) @@ -1401,7 +1402,7 @@ int cgroup_create_cgroup(struct cgroup *cgroup, int ignore_ownership) cgroup_dbg("failed to set %s: %s (%d)\n", path, cgroup_strerror(error), error); - retval = ECGROUPNOTEQUAL; + retval = ECGCANTSETVALUE; continue; } } @@ -1556,7 +1557,7 @@ free_parent: * @cgroup: cgroup data structure to be filled with parent values and then * passed down for creation * @ignore_ownership: Ignore doing a chown on the newly created cgroup - * @return 0 on success, > 0 on failure. If ECGROUPNOTEQUAL is returned, + * @return 0 on success, > 0 on failure. If ECGCANTSETVALUE is returned, * the group was created successfully, but not all controller parameters * were copied from the parent successfully; unfortunately, this is expected... */ -- 2.47.2