On 05/12/2011 08:58 AM, Jan Safranek wrote:
> I went through cgroup_dbg messages and increased they log level where I
> found it appropriate. I am pretty sure I missed other important ones, this
> is just a first attempt. Feel free to suggest additional messages.
>
> Signed-off-by: Jan Safranek<jsafr...@redhat.com>
> ---
>
>   src/api.c    |   29 +++++++++++++++--------------
>   src/config.c |    4 ++--
>   2 files changed, 17 insertions(+), 16 deletions(-)
>
> diff --git a/src/api.c b/src/api.c
> index babf4cb..a1808df 100644
> --- a/src/api.c
> +++ b/src/api.c
> @@ -456,9 +456,8 @@ static int cgroup_parse_rules(bool cache, uid_t muid,
>       pthread_rwlock_wrlock(&rl_lock);
>       fp = fopen(CGRULES_CONF_FILE, "re");
>       if (!fp) {
> -             cgroup_dbg("Failed to open configuration file %s with"
> -                             " error: %s\n", CGRULES_CONF_FILE,
> -                             strerror(errno));
> +             cgroup_err("Error: failed to open configuration file %s: %s\n",
> +                             CGRULES_CONF_FILE, strerror(errno));
>               last_errno = errno;
>               ret = ECGOTHER;
>               goto unlock;
> @@ -488,7 +487,7 @@ static int cgroup_parse_rules(bool cache, uid_t muid,
>                * of it (begins with %), then we should skip this rule too.
>                */
>               if (skipped&&  *itr == '%') {
> -                     cgroup_dbg("Warning: Skipped child of invalid rule,"
> +                     cgroup_warn("Warning: skipped child of invalid rule,"
>                                       " line %d.\n", linenum);
>                       continue;
>               }
> @@ -500,8 +499,8 @@ static int cgroup_parse_rules(bool cache, uid_t muid,
>               skipped = false;
>               i = sscanf(itr, "%s%s%s", key, controllers, destination);
>               if (i != 3) {
> -                     cgroup_dbg("Failed to parse configuration file on"
> -                                     " line %d.\n", linenum);
> +                     cgroup_err("Error: failed to parse configuration file"
> +                                     " on line %d.\n", linenum);
>                       goto parsefail;
>               }
>               procname = strchr(key, ':');
> @@ -511,8 +510,9 @@ static int cgroup_parse_rules(bool cache, uid_t muid,
>                       len_username = procname - key - 1;
>                       len_procname = strlen(procname);
>                       if (len_procname<  0) {
> -                             cgroup_dbg("Failed to parse configuration file"
> -                                             " on line %d.\n", linenum);
> +                             cgroup_err("Error: failed to parse"
> +                                             " configuration file on line"
> +                                             " %d.\n", linenum);
>                               goto parsefail;
>                       }
>               } else {
> @@ -656,16 +656,16 @@ static int cgroup_parse_rules(bool cache, uid_t muid,
>               /* Parse the controller list, and add that to newrule too. */
>               stok_buff = strtok(controllers, ",");
>               if (!stok_buff) {
> -                     cgroup_dbg("Failed to parse controllers on line"
> -                                     " %d\n", linenum);
> +                     cgroup_warn("Warning: failed to parse controllers on"
> +                                     " line %d\n", linenum);
>                       goto destroyrule;
>               }
>
>               i = 0;
>               do {
>                       if (i>= MAX_MNT_ELEMENTS) {
> -                             cgroup_dbg("Too many controllers listed"
> -                                     " on line %d\n", linenum);
> +                             cgroup_warn("Warning: too many controllers"
> +                                     " listed on line %d\n", linenum);
>                               goto destroyrule;
>                       }
>
> @@ -1068,7 +1068,7 @@ static int __cgroup_attach_task_pid(char *path, pid_t 
> tid)
>       fclose(tasks);
>       return 0;
>   err:
> -     cgroup_dbg("Error writing tid %d to %s:%s\n",
> +     cgroup_warn("Warning: cannot write tid %d to %s:%s\n",
>                       tid, path, strerror(errno));
>       fclose(tasks);
>       return ret;
> @@ -3413,7 +3413,8 @@ int cgroup_get_uid_gid_from_procfs(pid_t pid, uid_t 
> *euid, gid_t *egid)
>                * /proc/<pid>/status. The format has been changed
>                * and we should catch up the change.
>                */
> -             cgroup_dbg("The invlid file format of /proc/%d/status.\n", pid);
> +             cgroup_warn("Warning: invalid file format of"
> +                             " /proc/%d/status.\n", pid);
>               return ECGFAIL;
>       }
>       return 0;
> diff --git a/src/config.c b/src/config.c
> index f1873ea..566ea60 100644
> --- a/src/config.c
> +++ b/src/config.c
> @@ -706,14 +706,14 @@ int cgroup_config_load_config(const char *pathname)
>       yyin = fopen(pathname, "re");
>
>       if (!yyin) {
> -             cgroup_dbg("Failed to open file %s\n", pathname);
> +             cgroup_err("Error: Failed to open file %s\n", pathname);
Failed -> failed
>               last_errno = errno;
>               return ECGOTHER;
>       }
>
>       config_cgroup_table = calloc(MAX_CGROUPS, sizeof(struct cgroup));
>       if (yyparse() != 0) {
> -             cgroup_dbg("Failed to parse file %s\n", pathname);
> +             cgroup_err("Error: Failed to parse file %s\n", pathname);
Failed -> failed
>               fclose(yyin);
>               free(config_cgroup_table);
>               return ECGCONFIGPARSEFAIL;
>
>
> ------------------------------------------------------------------------------
> Achieve unprecedented app performance and reliability
> What every C/C++ and Fortran developer should know.
> Learn how Intel has extended the reach of its next-generation tools
> to help boost performance applications - inlcuding clusters.
> http://p.sf.net/sfu/intel-dev2devmay
> _______________________________________________
> Libcg-devel mailing list
> Libcg-devel@lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/libcg-devel


------------------------------------------------------------------------------
Achieve unprecedented app performance and reliability
What every C/C++ and Fortran developer should know.
Learn how Intel has extended the reach of its next-generation tools
to help boost performance applications - inlcuding clusters.
http://p.sf.net/sfu/intel-dev2devmay
_______________________________________________
Libcg-devel mailing list
Libcg-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/libcg-devel

Reply via email to