]> git.proxmox.com Git - mirror_lxcfs.git/commitdiff
uptime: fix pid1 and reaper_busy times
authorWolfgang Bumiller <w.bumiller@proxmox.com>
Mon, 14 Dec 2015 08:03:14 +0000 (09:03 +0100)
committerSerge Hallyn <serge.hallyn@ubuntu.com>
Thu, 17 Dec 2015 17:19:18 +0000 (09:19 -0800)
- reaper_busy was off by a factor of 10 (possibly originally
for precision?)
- get_pid1_time was expecting a '1' byte like in
the pid_to/from_ns_wrapper functions instead of reading its
value which is what is actually written

Signed-off-by: Wolfgang Bumiller <w.bumiller@proxmox.com>
Signed-off-by: Serge Hallyn <serge.hallyn@ubuntu.com>
lxcfs.c

diff --git a/lxcfs.c b/lxcfs.c
index 90a0b7fd7dedd78de6fcd63dae32f5834c037d71..fe5ac3e551f16fec40b317699e55e22aa56d59f5 100644 (file)
--- a/lxcfs.c
+++ b/lxcfs.c
@@ -2449,10 +2449,9 @@ static long int get_pid1_time(pid_t pid)
        ret = select(cpipe[0]+1, &s, NULL, NULL, &tv);
        if (ret <= 0)
                goto fail;
-       ret = read(cpipe[0], &v, 1);
-       if (ret != sizeof(char) || v != '1') {
+       ret = read(cpipe[0], &v, sizeof(v));
+       if (ret != sizeof(v))
                goto fail;
-       }
 
        wait_for_pid(cpid);
 
@@ -2607,7 +2606,7 @@ static unsigned long get_reaper_busy(pid_t task)
        if (!cgfs_get_value("cpuacct", cgroup, "cpuacct.usage", &usage_str))
                goto out;
        usage = strtoul(usage_str, NULL, 10);
-       usage /= 100000000;
+       usage /= 1000000000;
 
 out:
        free(cgroup);