Before this, I have discussed this problem with Arnd. And Arnd have
an idea that by converting timeval to long / long in input_event, so that
input_event structure size will be unchanged, and timeval structure will
removed entirely. But we also need to avoid using CLOCK_REALTIME in
userland, to keep the new input_event structure y2038 safe.
The input_event will only support monotonic time in Arnd's idea. And
we still need to add wall time support for old 32-bit binary.
Those patches try to keep original input capacity, and resolve y2038
problem in input_event radically.
struct input_event is only used between kernel and userspace
communication (except uinput). So that we can replace input_event
with input_event64 in kernel entirely, and add a conversion in
input_event_from/to_user() to keep compatible with old 32-bits binary.
userland can switch to input_event64, which is y2038 safe, via ioctl.
WEN Pingbo (3):
evdev: convert input_event to input_event64
evdev: add new ioctl EVIOCSEVENT / EVIOCGEVENT
uinput: convert input_event to input_event64
drivers/input/evdev.c | 38 ++++++++++++-------
drivers/input/input-compat.c | 88 +++++++++++++++++++++++++++++++++++++-------
drivers/input/input-compat.h | 9 +++--
drivers/input/misc/uinput.c | 17 ++++++---
include/linux/uinput.h | 2 +-
include/uapi/linux/input.h | 18 +++++++++
6 files changed, 134 insertions(+), 38 deletions(-)
--
1.9.1
You have received a new fax.
Scanned fax document is attached to this email.
Scanned by: Daniel Chamberlain
Document name: scan_0000852481.doc
Date: Thu, 5 Nov 2015 03:19:32 +0300
Scan quality: 500 DPI
File size: 144 Kb
Pages sent: 3
Scanned in: 47 seconds
Thanks for using Interfax service!
struct timeval' uses 32-bits for its seconds field and will overflow in
the year 2038 and beyond. This patch replaces the usage of 'struct timeval'
in mon_get_timestamp() with timespec64 which uses a 64-bit seconds field
and is y2038-safe. mon_get_timestamp() truncates the timestamp at 4096 seconds,
so the correctness of the code is not affected. This patch is part of a larger
attempt to remove instances of struct timeval and other 32-bit timekeeping
(time_t, struct timespec) from the kernel.
Signed-off-by: Tina Ruchandani <ruchandani.tina(a)gmail.com>
Suggested-by: Arnd Bergmann <arnd(a)arndb.de>
---
Changes in v2:
- Switch to monotonic time since we only care about time elapsed.
---
drivers/usb/mon/mon_text.c | 9 +++++----
1 file changed, 5 insertions(+), 4 deletions(-)
diff --git a/drivers/usb/mon/mon_text.c b/drivers/usb/mon/mon_text.c
index ad40825..98e4f63 100644
--- a/drivers/usb/mon/mon_text.c
+++ b/drivers/usb/mon/mon_text.c
@@ -9,6 +9,7 @@
#include <linux/usb.h>
#include <linux/slab.h>
#include <linux/time.h>
+#include <linux/ktime.h>
#include <linux/export.h>
#include <linux/mutex.h>
#include <linux/debugfs.h>
@@ -176,12 +177,12 @@ static inline char mon_text_get_data(struct mon_event_text *ep, struct urb *urb,
static inline unsigned int mon_get_timestamp(void)
{
- struct timeval tval;
+ struct timespec64 now;
unsigned int stamp;
- do_gettimeofday(&tval);
- stamp = tval.tv_sec & 0xFFF; /* 2^32 = 4294967296. Limit to 4096s. */
- stamp = stamp * 1000000 + tval.tv_usec;
+ ktime_get_ts64(&now);
+ stamp = now.tv_sec & 0xFFF; /* 2^32 = 4294967296. Limit to 4096s. */
+ stamp = stamp * USEC_PER_SEC + now.tv_nsec / NSEC_PER_USEC;
return stamp;
}
--
2.6.0.rc2.230.g3dd15c0
This patchset removes the use of struct timeval because struct timeval
will break in 32 bit systems in the year 2038.
Amitoj Kaur Chawla(2):
scsi: bfa: bfa_svc: Use ktime_get_real_seconds()
scsi: bfa: bfa_svc: Remove use of struct timeval
drivers/scsi/bfa/bfa_svc.c | 30 ++++++++----------------------
drivers/scsi/bfa/bfa_svc.h | 2 +-
2 files changed, 9 insertions(+), 23 deletions(-)
--
1.9.1
On Thursday 05 November 2015 14:34:48 Stefan Richter wrote:
> On Oct 22 Arnd Bergmann wrote:
> > On Thursday 22 October 2015 04:05:00 Amitoj Kaur Chawla wrote:
> > > 32 bit systems using 'struct timeval' will break in the year 2038, so
> > > we replace the code appropriately. However, this driver is not broken
> > > in 2038 since we are using only the microseconds portion of the
> > > current time.
> > >
> > > This patch replaces timeval with timespec64.
> > >
> > > Signed-off-by: Amitoj Kaur Chawla <amitoj1606(a)gmail.com>
> >
> > Reviewed-by: Arnd Bergmann <arnd(a)arndb.de>
> >
> > (adding the y2038 mailing list as well)
>
> Committed to linux1394.git.
> Arnd, do you have special y2038 plans that make it desirable to have this
> merged before v4.4? Otherwise I would submit it for v4.5-rc1.
4.5-rc1 is fine.
Arnd