Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

Use 64-bit timekeeping

This patch changes the use of struct timespec in
dccp_probe to use struct timespec64 instead. timespec uses a 32-bit
seconds field which will overflow in the year 2038 and beyond. timespec64
uses a 64-bit seconds field. Note that the correctness of the code isn't
changed, since the original code only uses the timestamps to compute a
small elapsed interval. This patch is part of a larger attempt to remove
instances of 32-bit timekeeping structures (timespec, timeval, time_t)
from the kernel so it is easier to identify where the real 2038 issues
are.

Signed-off-by: Tina Ruchandani <ruchandani.tina@gmail.com>
Signed-off-by: David S. Miller <davem@davemloft.net>

authored by

Tina Ruchandani and committed by
David S. Miller
1032a668 1cf7d8dd

+6 -5
+6 -5
net/dccp/probe.c
··· 30 30 #include <linux/module.h> 31 31 #include <linux/kfifo.h> 32 32 #include <linux/vmalloc.h> 33 + #include <linux/time64.h> 33 34 #include <linux/gfp.h> 34 35 #include <net/net_namespace.h> 35 36 ··· 48 47 struct kfifo fifo; 49 48 spinlock_t lock; 50 49 wait_queue_head_t wait; 51 - struct timespec tstart; 50 + struct timespec64 tstart; 52 51 } dccpw; 53 52 54 53 static void printl(const char *fmt, ...) 55 54 { 56 55 va_list args; 57 56 int len; 58 - struct timespec now; 57 + struct timespec64 now; 59 58 char tbuf[256]; 60 59 61 60 va_start(args, fmt); 62 - getnstimeofday(&now); 61 + getnstimeofday64(&now); 63 62 64 - now = timespec_sub(now, dccpw.tstart); 63 + now = timespec64_sub(now, dccpw.tstart); 65 64 66 65 len = sprintf(tbuf, "%lu.%06lu ", 67 66 (unsigned long) now.tv_sec, ··· 111 110 static int dccpprobe_open(struct inode *inode, struct file *file) 112 111 { 113 112 kfifo_reset(&dccpw.fifo); 114 - getnstimeofday(&dccpw.tstart); 113 + getnstimeofday64(&dccpw.tstart); 115 114 return 0; 116 115 } 117 116