summaryrefslogtreecommitdiff
path: root/kernel/time/posix-stubs.c
diff options
context:
space:
mode:
authorAndrei Vagin <avagin@openvz.org>2019-11-12 04:27:00 +0300
committerThomas Gleixner <tglx@linutronix.de>2020-01-14 14:20:52 +0300
commit5a590f35add93c2bdf3ed83eee73111021679562 (patch)
tree259e9f5d400065e26a4a3b6f0a2ac98b39c9e096 /kernel/time/posix-stubs.c
parent198fa445d5c4c1a1c6c1d39f962559f8d008e79d (diff)
downloadlinux-5a590f35add93c2bdf3ed83eee73111021679562.tar.xz
posix-clocks: Wire up clock_gettime() with timens offsets
Adjust monotonic and boottime clocks with per-timens offsets. As the result a process inside time namespace will see timers and clocks corrected to offsets that were set when the namespace was created Note that applications usually go through vDSO to get time, which is not yet adjusted. Further changes will complete time namespace virtualisation with vDSO support. Co-developed-by: Dmitry Safonov <dima@arista.com> Signed-off-by: Andrei Vagin <avagin@gmail.com> Signed-off-by: Dmitry Safonov <dima@arista.com> Signed-off-by: Thomas Gleixner <tglx@linutronix.de> Link: https://lore.kernel.org/r/20191112012724.250792-12-dima@arista.com
Diffstat (limited to 'kernel/time/posix-stubs.c')
-rw-r--r--kernel/time/posix-stubs.c3
1 files changed, 3 insertions, 0 deletions
diff --git a/kernel/time/posix-stubs.c b/kernel/time/posix-stubs.c
index 20c65a7d4e3a..bcbaa2045f5e 100644
--- a/kernel/time/posix-stubs.c
+++ b/kernel/time/posix-stubs.c
@@ -14,6 +14,7 @@
#include <linux/ktime.h>
#include <linux/timekeeping.h>
#include <linux/posix-timers.h>
+#include <linux/time_namespace.h>
#include <linux/compat.h>
#ifdef CONFIG_ARCH_HAS_SYSCALL_WRAPPER
@@ -77,9 +78,11 @@ int do_clock_gettime(clockid_t which_clock, struct timespec64 *tp)
break;
case CLOCK_MONOTONIC:
ktime_get_ts64(tp);
+ timens_add_monotonic(tp);
break;
case CLOCK_BOOTTIME:
ktime_get_boottime_ts64(tp);
+ timens_add_boottime(tp);
break;
default:
return -EINVAL;