The following pull request was submitted through Github.
It can be accessed and reviewed at: https://github.com/lxc/lxcfs/pull/409

This e-mail was sent by the LXC bot, direct replies will not reach the author
unless they happen to be subscribed to this list.

=== Description (from pull-request) ===
Closes: #406.
Signed-off-by: Christian Brauner <christian.brau...@ubuntu.com>
From 1494771eb4f0391bd49a26f91f9918e0ba37ac82 Mon Sep 17 00:00:00 2001
From: Christian Brauner <christian.brau...@ubuntu.com>
Date: Tue, 2 Jun 2020 16:10:20 +0200
Subject: [PATCH] cpuview: fix /proc/stat virtualization

Closes: #406.
Signed-off-by: Christian Brauner <christian.brau...@ubuntu.com>
---
 src/proc_fuse.c | 8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)

diff --git a/src/proc_fuse.c b/src/proc_fuse.c
index ae06bff..41ac0b1 100644
--- a/src/proc_fuse.c
+++ b/src/proc_fuse.c
@@ -780,6 +780,10 @@ static int proc_stat_read(char *buf, size_t size, off_t 
offset,
        if (!f)
                return 0;
 
+       /* Skip first system cpu line. */
+       if (getline(&line, &linelen, f) < 0)
+               return log_error(0, "proc_stat_read read first line failed");
+
        /*
         * Read cpuacct.usage_all for all CPUs.
         * If the cpuacct cgroup is present, it is used to calculate the 
container's
@@ -796,10 +800,6 @@ static int proc_stat_read(char *buf, size_t size, off_t 
offset,
                lxcfs_v("proc_stat_read failed to read from cpuacct, falling 
back to the host's /proc/stat");
        }
 
-       //skip first line
-       if (getline(&line, &linelen, f) < 0)
-               return log_error(0, "proc_stat_read read first line failed");
-
        while (getline(&line, &linelen, f) != -1) {
                ssize_t l;
                char cpu_char[10]; /* That's a lot of cores */
_______________________________________________
lxc-devel mailing list
lxc-devel@lists.linuxcontainers.org
http://lists.linuxcontainers.org/listinfo/lxc-devel

Reply via email to