static void usage(int status, const char *program_name)
{
if (status != 0) {
- fprintf(stderr, "Wrong input parameters,");
- fprintf(stderr, " try %s -h' for more information.\n",
- program_name);
+ err("Wrong input parameters, ");
+ err("try %s -h' for more information.\n", program_name);
return;
}
- printf("Usage: %s [-h] [[-g] <controllers>:<path>] [...]\n",
- program_name);
- printf("List all cgroups\n");
- printf(" -g <controllers>:<path> Control group to be ");
- printf("displayed (-g is optional)\n");
- printf(" -h, --help Display this help\n");
+
+ info("Usage: %s [-h] [[-g] <controllers>:<path>] [...]\n",
+ program_name);
+ info("List all cgroups\n");
+ info(" -g <controllers>:<path> Control group to be ");
+ info("displayed (-g is optional)\n");
+ info(" -h, --help Display this help\n");
}
/*
{
if (info->type == CGROUP_FILE_TYPE_DIR) {
if (info->full_path[pref] == '/')
- printf("%s:%s\n", name, &info->full_path[pref]);
+ info("%s:%s\n", name, &info->full_path[pref]);
else
- printf("%s:/%s\n", name, &info->full_path[pref]);
+ info("%s:/%s\n", name, &info->full_path[pref]);
}
}
/* initialize libcgroup */
ret = cgroup_init();
if (ret) {
- fprintf(stderr, "cgroups can't be listed: %s\n",
- cgroup_strerror(ret));
+ err("cgroups can't be listed: %s\n", cgroup_strerror(ret));
return ret;
}
final_ret = 0;
} else {
final_ret = ret;
- fprintf(stderr, "cgroups can't be listed: %s\n",
- cgroup_strerror(ret));
+ err("cgroups can't be listed: %s\n",
+ cgroup_strerror(ret));
}
} else {
/* we have he list of controllers which should be print */
/* other problem */
final_ret = ret;
}
- fprintf(stderr,
- "%s: cannot find group %s..:%s: %s\n",
- tname, cgroup_list[i]->controllers[0],
- cgroup_list[i]->path,
- cgroup_strerror(final_ret));
+ err("%s: cannot find group %s..:%s: %s\n",
+ tname, cgroup_list[i]->controllers[0],
+ cgroup_list[i]->path,
+ cgroup_strerror(final_ret));
}
i++;
}
ret = parse_cgroup_spec(cgroup_list, optarg,
CG_HIER_MAX);
if (ret) {
- fprintf(stderr, "%s: cgroup controller and ",
- argv[0]);
- fprintf(stderr, "path parsing failed (%s)\n",
- optarg);
+ err("%s: cgroup controller and path", argv[0]);
+ err(" path parsing failed (%s)\n", optarg);
return ret;
}
break;
ret = parse_cgroup_spec(cgroup_list, argv[optind],
CG_HIER_MAX);
if (ret) {
- fprintf(stderr, "%s: cgroup controller", argv[0]);
- fprintf(stderr, " and path parsing failed (%s)\n",
- argv[optind]);
+ err("%s: cgroup controller an path parsing ", argv[0]);
+ err("failed (%s)\n", argv[optind]);
return -1;
}
optind++;