Skip to content

Commit

Permalink
uptime: fix pid1 and reaper_busy times
Browse files Browse the repository at this point in the history
- 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 <[email protected]>
Signed-off-by: Serge Hallyn <[email protected]>
  • Loading branch information
Blub authored and hallyn committed Dec 17, 2015
1 parent 121013f commit 87e9696
Showing 1 changed file with 3 additions and 4 deletions.
7 changes: 3 additions & 4 deletions lxcfs.c
Original file line number Diff line number Diff line change
Expand Up @@ -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);

Expand Down Expand Up @@ -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);
Expand Down

0 comments on commit 87e9696

Please sign in to comment.