[lxc-devel] [lxc/master] tools/lxc_top: removed internal logging

AustinReichert on Github lxc-bot at linuxcontainers.org
Wed Nov 29 00:00:37 UTC 2017


A non-text attachment was scrubbed...
Name: not available
Type: text/x-mailbox
Size: 361 bytes
Desc: not available
URL: <http://lists.linuxcontainers.org/pipermail/lxc-devel/attachments/20171129/dc6eae8e/attachment.bin>
-------------- next part --------------
From 8052112c2306ffe6ac4842625134575413050d5b Mon Sep 17 00:00:00 2001
From: AustinReichert <austinskyreichert at utexas.edu>
Date: Tue, 28 Nov 2017 17:35:45 -0600
Subject: [PATCH] tools/lxc_top: removed internal logging

Signed-off-by: AustinReichert <austinskyreichert at utexas.edu>
---
 src/lxc/tools/lxc_top.c | 26 ++++++++++++--------------
 1 file changed, 12 insertions(+), 14 deletions(-)

diff --git a/src/lxc/tools/lxc_top.c b/src/lxc/tools/lxc_top.c
index e42137d8b..cc0ed0c1a 100644
--- a/src/lxc/tools/lxc_top.c
+++ b/src/lxc/tools/lxc_top.c
@@ -41,8 +41,6 @@
 #include "mainloop.h"
 #include "utils.h"
 
-lxc_log_define(lxc_top_ui, lxc);
-
 #define USER_HZ   100
 #define ESC       "\033"
 #define TERMCLEAR ESC "[H" ESC "[J"
@@ -149,12 +147,12 @@ static int stdin_tios_setup(void)
 	struct termios newtios;
 
 	if (!isatty(0)) {
-		ERROR("stdin is not a tty");
+		fprintf(stderr, "stdin is not a tty\n");
 		return -1;
 	}
 
 	if (tcgetattr(0, &oldtios)) {
-		SYSERROR("failed to get current terminal settings");
+		fprintf(stderr, "failed to get current terminal settings\n");
 		return -1;
 	}
 
@@ -168,7 +166,7 @@ static int stdin_tios_setup(void)
 	newtios.c_cc[VTIME] = 0;
 
 	if (tcsetattr(0, TCSAFLUSH, &newtios)) {
-		ERROR("failed to set new terminal settings");
+		fprintf(stderr, "failed to set new terminal settings\n");
 		return -1;
 	}
 
@@ -233,7 +231,7 @@ static uint64_t stat_get_int(struct lxc_container *c, const char *item)
 
 	len = c->get_cgroup_item(c, item, buf, sizeof(buf));
 	if (len <= 0) {
-		ERROR("unable to read cgroup item %s", item);
+		fprintf(stderr, "unable to read cgroup item %s\n", item);
 		return 0;
 	}
 
@@ -252,7 +250,7 @@ static uint64_t stat_match_get_int(struct lxc_container *c, const char *item,
 
 	len = c->get_cgroup_item(c, item, buf, sizeof(buf));
 	if (len <= 0) {
-		ERROR("unable to read cgroup item %s", item);
+		fprintf(stderr, "unable to read cgroup item %s\n", item);
 		goto out;
 	}
 
@@ -308,7 +306,7 @@ static void stat_get_blk_stats(struct lxc_container *c, const char *item,
 
 	len = c->get_cgroup_item(c, item, buf, sizeof(buf));
 	if (len <= 0 || len >= sizeof(buf)) {
-		ERROR("unable to read cgroup item %s", item);
+		fprintf(stderr, "unable to read cgroup item %s\n", item);
 		return;
 	}
 
@@ -407,7 +405,7 @@ static void stats_print(const char *name, const struct stats *stats,
 
 		ret = snprintf(iosb_str, sizeof(iosb_str), "%s(%s/%s)", iosb_total_str, iosb_read_str, iosb_write_str);
 		if (ret < 0 || ret >= sizeof(iosb_str))
-			WARN("snprintf'd too many characters: %d", ret);
+			printf("snprintf'd too many characters: %d\n", ret);
 
 		printf("%-18.18s %12.2f %12.2f %12.2f %36s %10s",
 		       name,
@@ -537,13 +535,13 @@ static void ct_realloc(int active_cnt)
 		ct_free();
 		ct = realloc(ct, sizeof(*ct) * active_cnt);
 		if (!ct) {
-			ERROR("cannot alloc mem");
+			fprintf(stderr, "cannot alloc mem\n");
 			exit(EXIT_FAILURE);
 		}
 		for (i = 0; i < active_cnt; i++) {
 			ct[i].stats = malloc(sizeof(*ct[0].stats));
 			if (!ct[i].stats) {
-				ERROR("cannot alloc mem");
+				fprintf(stderr, "cannot alloc mem\n");
 				exit(EXIT_FAILURE);
 			}
 		}
@@ -563,7 +561,7 @@ int main(int argc, char *argv[])
 
 	ct_print_cnt = stdin_tios_rows() - 3; /* 3 -> header and total */
 	if (stdin_tios_setup() < 0) {
-		ERROR("failed to setup terminal");
+		fprintf(stderr, "failed to setup terminal\n");
 		goto out;
 	}
 
@@ -573,13 +571,13 @@ int main(int argc, char *argv[])
 	signal(SIGQUIT, sig_handler);
 
 	if (lxc_mainloop_open(&descr)) {
-		ERROR("failed to create mainloop");
+		fprintf(stderr, "failed to create mainloop\n");
 		goto out;
 	}
 
 	ret = lxc_mainloop_add_handler(&descr, 0, stdin_handler, &in_char);
 	if (ret) {
-		ERROR("failed to add stdin handler");
+		fprintf(stderr, "failed to add stdin handler\n");
 		ret = EXIT_FAILURE;
 		goto err1;
 	}


More information about the lxc-devel mailing list