lkml.org 
[lkml]   [2019]   [Feb]   [5]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
    Patch in this message
    /
    From
    Subject[PATCH 08/32] timens: Shift /proc/uptime
    Date
    Respect boottime inside time namespace for /proc/uptime

    Signed-off-by: Dmitry Safonov <dima@arista.com>
    ---
    fs/proc/uptime.c | 3 +++
    1 file changed, 3 insertions(+)

    diff --git a/fs/proc/uptime.c b/fs/proc/uptime.c
    index a4c2791ab70b..4421ec058472 100644
    --- a/fs/proc/uptime.c
    +++ b/fs/proc/uptime.c
    @@ -5,6 +5,7 @@
    #include <linux/sched.h>
    #include <linux/seq_file.h>
    #include <linux/time.h>
    +#include <linux/time_namespace.h>
    #include <linux/kernel_stat.h>

    static int uptime_proc_show(struct seq_file *m, void *v)
    @@ -20,6 +21,8 @@ static int uptime_proc_show(struct seq_file *m, void *v)
    nsec += (__force u64) kcpustat_cpu(i).cpustat[CPUTIME_IDLE];

    ktime_get_boottime_ts64(&uptime);
    + timens_clock_from_host(CLOCK_BOOTTIME, &uptime);
    +
    idle.tv_sec = div_u64_rem(nsec, NSEC_PER_SEC, &rem);
    idle.tv_nsec = rem;
    seq_printf(m, "%lu.%02lu %lu.%02lu\n",
    --
    2.20.1
    \
     
     \ /
      Last update: 2019-02-06 01:13    [W:3.073 / U:0.016 seconds]
    ©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site