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

y2038: hide timeval/timespec/itimerval/itimerspec types

There are no in-kernel users remaining, but there may still be users that
include linux/time.h instead of sys/time.h from user space, so leave the
types available to user space while hiding them from kernel space.

Only the __kernel_old_* versions of these types remain now.

Link: http://lkml.kernel.org/r/20200110154232.4104492-4-arnd@arndb.de
Signed-off-by: Arnd Bergmann <arnd@arndb.de>
Acked-by: Thomas Gleixner <tglx@linutronix.de>
Cc: Deepa Dinamani <deepa.kernel@gmail.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>

authored by

Arnd Bergmann and committed by
Linus Torvalds
c766d147 412c53a6

+14 -10
+2
include/uapi/asm-generic/posix_types.h
··· 87 87 typedef __kernel_long_t __kernel_off_t; 88 88 typedef long long __kernel_loff_t; 89 89 typedef __kernel_long_t __kernel_old_time_t; 90 + #ifndef __KERNEL__ 90 91 typedef __kernel_long_t __kernel_time_t; 92 + #endif 91 93 typedef long long __kernel_time64_t; 92 94 typedef __kernel_long_t __kernel_clock_t; 93 95 typedef int __kernel_timer_t;
+12 -10
include/uapi/linux/time.h
··· 5 5 #include <linux/types.h> 6 6 #include <linux/time_types.h> 7 7 8 + #ifndef __KERNEL__ 8 9 #ifndef _STRUCT_TIMESPEC 9 10 #define _STRUCT_TIMESPEC 10 11 struct timespec { ··· 19 18 __kernel_suseconds_t tv_usec; /* microseconds */ 20 19 }; 21 20 21 + struct itimerspec { 22 + struct timespec it_interval;/* timer period */ 23 + struct timespec it_value; /* timer expiration */ 24 + }; 25 + 26 + struct itimerval { 27 + struct timeval it_interval;/* timer interval */ 28 + struct timeval it_value; /* current value */ 29 + }; 30 + #endif 31 + 22 32 struct timezone { 23 33 int tz_minuteswest; /* minutes west of Greenwich */ 24 34 int tz_dsttime; /* type of dst correction */ ··· 42 30 #define ITIMER_REAL 0 43 31 #define ITIMER_VIRTUAL 1 44 32 #define ITIMER_PROF 2 45 - 46 - struct itimerspec { 47 - struct timespec it_interval; /* timer period */ 48 - struct timespec it_value; /* timer expiration */ 49 - }; 50 - 51 - struct itimerval { 52 - struct timeval it_interval; /* timer interval */ 53 - struct timeval it_value; /* current value */ 54 - }; 55 33 56 34 /* 57 35 * The IDs of the various system clocks (for POSIX.1b interval timers):