[lxc-devel] [lxc/master] Increased buffer length in print_stats()

d4s on Github lxc-bot at linuxcontainers.org
Thu Mar 30 15:57:34 UTC 2017


A non-text attachment was scrubbed...
Name: not available
Type: text/x-mailbox
Size: 593 bytes
Desc: not available
URL: <http://lists.linuxcontainers.org/pipermail/lxc-devel/attachments/20170330/a0603be1/attachment.bin>
-------------- next part --------------
From 1bbc627538f4b345481ef55a7fe65e565f3810c5 Mon Sep 17 00:00:00 2001
From: Denis Pynkin <dans at altlinux.org>
Date: Thu, 30 Mar 2017 18:31:48 +0300
Subject: [PATCH] Increased buffer length in print_stats()

Some "/sys" entries exceeds buffer size.
This results to some statistics loss ('BlkIO' in particular):

 wc -c /sys/fs/cgroup/blkio/lxc/alt/blkio.throttle.io_service_bytes
 318 /sys/fs/cgroup/blkio/lxc/alt/blkio.throttle.io_service_bytes

Signed-off-by: Denis Pynkin <dans at altlinux.org>
---
 src/lxc/tools/lxc_info.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/src/lxc/tools/lxc_info.c b/src/lxc/tools/lxc_info.c
index 2888537..c977f29 100644
--- a/src/lxc/tools/lxc_info.c
+++ b/src/lxc/tools/lxc_info.c
@@ -204,7 +204,7 @@ static void print_net_stats(struct lxc_container *c)
 static void print_stats(struct lxc_container *c)
 {
 	int i, ret;
-	char buf[256];
+	char buf[4096];
 
 	ret = c->get_cgroup_item(c, "cpuacct.usage", buf, sizeof(buf));
 	if (ret > 0 && ret < sizeof(buf)) {


More information about the lxc-devel mailing list