uptime: Convert uptime to use 64bit time accessor
RFC PATCH 1/1 uptime: Convert uptime to use 64bit time accessor
Convert the uptime output to use the timespec64 structure.
Cc Arnd Bergmann <[email protected]>
Cc Rik van Riel <[email protected]>
Cc Frederic Weisbecker <[email protected]>
Signed-off-by John Stultz <[email protected]>
--- fs/proc/uptime.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-)
fs/proc/uptime.c +4 -4
@@ -9,7 +9,7 @@static int uptime_proc_show (struct seq_file *m,void *v) { -struct timespec uptime; +struct timespec64 uptime;struct timespec idle;u64 idletime;u64 nsec;
@@ -20,12 +20,12 @@ static int uptime_proc_show(struct seq_file *m, void *v)for_each_possible_cpu (i) idletime += (__force u64 )kcpustat_cpu (i).cpustat[CPUTIME_IDLE ]; -get_monotonic_boottime (&uptime); +get_monotonic_boottime64 (&uptime); nsec =cputime64_to_jiffies64 (idletime) *TICK_NSEC ; idle.tv_sec =div_u64_rem (nsec,NSEC_PER_SEC , &rem); idle.tv_nsec = rem; -seq_printf (m,"%lu.%02lu %lu.%02lu\n" , - (unsigned long ) uptime.tv_sec, +seq_printf (m,"%llu.%02lu %lu.%02lu\n" , + (unsigned long long ) uptime.tv_sec, (uptime.tv_nsec / (NSEC_PER_SEC /100 )), (unsigned long ) idle.tv_sec, (idle.tv_nsec / (NSEC_PER_SEC /100 )));
Signature · 1 line
1.9.1
Quoted 1 line · John Stultz
Convert the uptime output to use the timespec64 structure.
That looks correct but the changelog lacks a reason :-)
Quoted 40 lines
Cc Arnd Bergmann <[email protected]>Cc Rik van Riel <[email protected]>Cc Frederic Weisbecker <[email protected]>Signed-off-by John Stultz <[email protected]>--- fs/proc/uptime.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-)fs/proc/uptime.c +4
-4@@ -9,7 +9,7 @@static int uptime_proc_show (struct seq_file *m,void *v) { -struct timespec uptime; +struct timespec64 uptime;struct timespec idle;u64 idletime;u64 nsec;@@ -20,12 +20,12 @@ static int uptime_proc_show(struct seq_file *m, void *v)for_each_possible_cpu (i) idletime += (__force u64 )kcpustat_cpu (i).cpustat[CPUTIME_IDLE ]; -get_monotonic_boottime (&uptime); +get_monotonic_boottime64 (&uptime); nsec =cputime64_to_jiffies64 (idletime) *TICK_NSEC ; idle.tv_sec =div_u64_rem (nsec,NSEC_PER_SEC , &rem); idle.tv_nsec = rem; -seq_printf (m,"%lu.%02lu %lu.%02lu\n" , - (unsigned long ) uptime.tv_sec, +seq_printf (m,"%llu.%02lu %lu.%02lu\n" , + (unsigned long long ) uptime.tv_sec, (uptime.tv_nsec / (NSEC_PER_SEC /100 )), (unsigned long ) idle.tv_sec, (idle.tv_nsec / (NSEC_PER_SEC /100 )));Signature · 1 line
1.9.1
Quoted 5 lines · Frederic Weisbecker
Quoted 1 line · John Stultz
Convert the uptime output to use the timespec64 structure.
That looks correct but the changelog lacks a reason :-)
Yes, sorry. I'll add a better rational to the next revision. thanks
-john