[lxc-devel] [lxcfs/master] bugfixes

brauner on Github lxc-bot at linuxcontainers.org
Mon Jun 12 13:49:32 UTC 2017


A non-text attachment was scrubbed...
Name: not available
Type: text/x-mailbox
Size: 365 bytes
Desc: not available
URL: <http://lists.linuxcontainers.org/pipermail/lxc-devel/attachments/20170612/3a11565e/attachment.bin>
-------------- next part --------------
From 2416e70e53de4d128f3e704144495b007ed6c04e Mon Sep 17 00:00:00 2001
From: Christian Brauner <christian.brauner at ubuntu.com>
Date: Mon, 12 Jun 2017 14:45:44 +0200
Subject: [PATCH 1/2] bindings: calculate btime correctly

Signed-off-by: Christian Brauner <christian.brauner at ubuntu.com>
---
 bindings.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/bindings.c b/bindings.c
index 3aaf5f9..f3aefa1 100644
--- a/bindings.c
+++ b/bindings.c
@@ -3606,7 +3606,7 @@ static uint64_t get_reaper_btime(pid)
 
 	uptime = (uint64_t)time(NULL) - (uint64_t)sys.uptime;
 	procstart = get_reaper_start_time_in_sec(pid);
-	return uptime - procstart;
+	return uptime + procstart;
 }
 
 #define CPUALL_MAX_SIZE (BUF_RESERVE_SIZE / 2)

From b0841cc14b575533780db16af61c653d4d2641c1 Mon Sep 17 00:00:00 2001
From: Christian Brauner <christian.brauner at ubuntu.com>
Date: Mon, 12 Jun 2017 15:47:13 +0200
Subject: [PATCH 2/2] tests: fix invalid comparison

We now follow the host's /proc/uptime in that we report two digits after the dot
too. Adapt the tests too.

Signed-off-by: Christian Brauner <christian.brauner at ubuntu.com>
---
 tests/test_proc | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/tests/test_proc b/tests/test_proc
index a965a68..1ba1a14 100755
--- a/tests/test_proc
+++ b/tests/test_proc
@@ -36,7 +36,7 @@ echo $((64*1024*1024)) > ${mempath}/lxcfs_test_proc/memory.limit_in_bytes
 echo 0 > ${cpupath}/lxcfs_test_proc/cpuset.cpus
 
 # Test uptime
-[ "$(cat ${LXCFSDIR}/proc/uptime)" = "0.0 0.0" ]
+[ "$(cat ${LXCFSDIR}/proc/uptime)" = "0.00 0.00" ]
 
 # Test cpuinfo
 [ "$(grep "^processor" ${LXCFSDIR}/proc/cpuinfo | wc -l)" = "1" ]


More information about the lxc-devel mailing list