]>
Commit | Line | Data |
---|---|---|
44b8d297 WB |
1 | From bb3f1796d71b17a2dd0502b2c43a38d6d07efb46 Mon Sep 17 00:00:00 2001 |
2 | From: Wolfgang Bumiller <w.bumiller@proxmox.com> | |
3 | Date: Mon, 14 Dec 2015 08:57:12 +0100 | |
4 | Subject: [PATCH lxcfs] uptime: fix pid1 and reaper_busy times | |
5 | ||
6 | - reaper_busy was off by a factor of 10 (possibly originally | |
7 | for precision?) | |
8 | - get_pid1_time was expecting a '1' byte like in | |
9 | the pid_to/from_ns_wrapper functions instead of reading its | |
10 | value which is what is actually written | |
11 | ||
12 | Signed-off-by: Wolfgang Bumiller <w.bumiller@proxmox.com> | |
13 | --- | |
14 | lxcfs.c | 7 +++---- | |
15 | 1 file changed, 3 insertions(+), 4 deletions(-) | |
16 | ||
17 | diff --git a/lxcfs.c b/lxcfs.c | |
18 | index 90a0b7f..fe5ac3e 100644 | |
19 | --- a/lxcfs.c | |
20 | +++ b/lxcfs.c | |
21 | @@ -2449,10 +2449,9 @@ static long int get_pid1_time(pid_t pid) | |
22 | ret = select(cpipe[0]+1, &s, NULL, NULL, &tv); | |
23 | if (ret <= 0) | |
24 | goto fail; | |
25 | - ret = read(cpipe[0], &v, 1); | |
26 | - if (ret != sizeof(char) || v != '1') { | |
27 | + ret = read(cpipe[0], &v, sizeof(v)); | |
28 | + if (ret != sizeof(v)) | |
29 | goto fail; | |
30 | - } | |
31 | ||
32 | wait_for_pid(cpid); | |
33 | ||
34 | @@ -2607,7 +2606,7 @@ static unsigned long get_reaper_busy(pid_t task) | |
35 | if (!cgfs_get_value("cpuacct", cgroup, "cpuacct.usage", &usage_str)) | |
36 | goto out; | |
37 | usage = strtoul(usage_str, NULL, 10); | |
38 | - usage /= 100000000; | |
39 | + usage /= 1000000000; | |
40 | ||
41 | out: | |
42 | free(cgroup); | |
43 | -- | |
44 | 2.1.4 | |
45 |