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 [-nv] [-r <name>] [-g <controllers>] ",
- program_name);
- printf("[-a] <path> ...\n");
- printf(" or: %s [-nv] [-r <name>] -g <controllers>:<path> ...\n",
- program_name);
- printf("Print parameter(s) of given group(s).\n");
- printf(" -1, --v1 Provided parameters are in ");
- printf("v1 format\n");
- printf(" -2, --v2 Provided parameters are in ");
- printf("v2 format\n");
- printf(" -i, --ignore-unmappable Do not return an error for settings ");
- printf("that cannot be converted\n");
- printf(" -a, --all Print info about all relevant ");
- printf("controllers\n");
- printf(" -g <controllers> Controller which info should ");
- printf("be displayed\n");
- printf(" -g <controllers>:<path> Control group which info ");
- printf("should be displayed\n");
- printf(" -h, --help Display this help\n");
- printf(" -n Do not print headers\n");
- printf(" -r, --variable <name> Define parameter to display\n");
- printf(" -v, --values-only Print only values, not ");
- printf("parameter names\n");
+ info("Usage: %s [-nv] [-r <name>] [-g <controllers>] ",
+ program_name);
+ info("[-a] <path> ...\n");
+ info(" or: %s [-nv] [-r <name>] -g <controllers>:<path> ...\n",
+ program_name);
+ info("Print parameter(s) of given group(s).\n");
+ info(" -1, --v1 Provided parameters are in ");
+ info("v1 format\n");
+ info(" -2, --v2 Provided parameters are in ");
+ info("v2 format\n");
+ info(" -i, --ignore-unmappable Do not return an error for ");
+ info("settings that cannot be converted\n");
+ info(" -a, --all Print info about all relevant");
+ info(" controllers\n");
+ info(" -g <controllers> Controller which info should");
+ info(" be displayed\n");
+ info(" -g <controllers>:<path> Control group which info");
+ info(" should be displayed\n");
+ info(" -h, --help Display this help\n");
+ info(" -n Do not print headers\n");
+ info(" -r, --variable <name> Define parameter to display\n");
+ info(" -v, --values-only Print only values, not ");
+ info("parameter names\n");
}
static int get_controller_from_name(const char * const name,
dot = strchr(*controller, '.');
if (dot == NULL) {
- fprintf(stderr, "cgget: error parsing parameter name\n '%s'",
- name);
+ err("cgget: error parsing parameter name\n '%s'", name);
return ECGINVAL;
}
*dot = '\0';
if (!cgc) {
cgc = cgroup_add_controller(cg, cntl_value_controller);
if (!cgc) {
- fprintf(stderr, "cgget: cannot find controller '%s'\n",
- cntl_value_controller);
+ err("cgget: cannot find controller '%s'\n",
+ cntl_value_controller);
ret = ECGOTHER;
goto out;
}
*/
tmp_ret = cgroup_test_subsys_mounted(controller_name);
if (tmp_ret == 0) {
- fprintf(stderr, "cgget: cannot find controller ");
- fprintf(stderr, "'%s' in group '%s'\n", controller_name,
- cg_name);
+ err("cgget: cannot find controller '%s' in ",
+ controller_name);
+ err("in group '%s'\n", cg_name);
} else {
- fprintf(stderr, "variable file read failed %s\n",
- cgroup_strerror(ret));
+ err("variable file read failed %s\n",
+ cgroup_strerror(ret));
}
}
int mode)
{
if (mode & MODE_SHOW_NAMES)
- printf("%s: ", cv->name);
+ info("%s: ", cv->name);
if (cv->multiline_value)
- printf("%s\n", cv->multiline_value);
+ info("%s\n", cv->multiline_value);
else
- printf("%s\n", cv->value);
+ info("%s\n", cv->value);
}
static void print_controller(const struct cgroup_controller * const cgc,
int i;
if (mode & MODE_SHOW_HEADERS)
- printf("%s:\n", cg->name);
+ info("%s:\n", cg->name);
for (i = 0; i < cg->index; i++)
print_controller(cg->controller[i], mode);
if (mode & MODE_SHOW_HEADERS)
- printf("\n");
+ info("\n");
}
static void print_cgroups(struct cgroup *cg_list[], int cg_list_len, int mode)
ret = cgroup_init();
if (ret) {
- fprintf(stderr, "%s: libcgroup initialization failed: %s\n",
- argv[0], cgroup_strerror(ret));
+ err("%s: libcgroup initialization failed: %s\n", argv[0],
+ cgroup_strerror(ret));
goto err;
}