[02/23] y2038: add __kernel_old_timespec and __kernel_old_time_t

Message ID 20191108210824.1534248-2-arnd@arndb.de
State New
Headers show
Series
  • y2038 cleanups
Related show

Commit Message

Arnd Bergmann Nov. 8, 2019, 9:07 p.m.
The 'struct timespec' definition can no longer be part of the uapi headers
because it conflicts with a a now incompatible libc definition. Also,
we really want to remove it in order to prevent new uses from creeping in.

The same namespace conflict exists with time_t, which should also be
removed. __kernel_time_t could be used safely, but adding 'old' in the
name makes it clearer that this should not be used for new interfaces.

Add a replacement __kernel_old_timespec structure and __kernel_old_time_t
along the lines of __kernel_old_timeval.

Signed-off-by: Arnd Bergmann <arnd@arndb.de>

---
 include/uapi/asm-generic/posix_types.h | 1 +
 include/uapi/linux/time_types.h        | 5 +++++
 2 files changed, 6 insertions(+)

-- 
2.20.0

Comments

Deepa Dinamani Nov. 9, 2019, 7:02 p.m. | #1
Acked-by: Deepa Dinamani <deepa.kernel@gmail.com>
Ben Hutchings Nov. 20, 2019, 10:30 p.m. | #2
On Fri, 2019-11-08 at 22:07 +0100, Arnd Bergmann wrote:
> The 'struct timespec' definition can no longer be part of the uapi headers

> because it conflicts with a a now incompatible libc definition. Also,

> we really want to remove it in order to prevent new uses from creeping in.

> 

> The same namespace conflict exists with time_t, which should also be

> removed. __kernel_time_t could be used safely, but adding 'old' in the

> name makes it clearer that this should not be used for new interfaces.

> 

> Add a replacement __kernel_old_timespec structure and __kernel_old_time_t

> along the lines of __kernel_old_timeval.

[...]
> --- a/include/uapi/linux/time_types.h

> +++ b/include/uapi/linux/time_types.h

> @@ -28,6 +28,11 @@ struct __kernel_old_timeval {

>  };

>  #endif

>  

> +struct __kernel_old_timespec {

> +	__kernel_time_t	tv_sec;			/* seconds */


Should this be __kernel_old_time_t for consistency?

Ben.

> +	long		tv_nsec;		/* nanoseconds */

> +};

> +

>  struct __kernel_sock_timeval {

>  	__s64 tv_sec;

>  	__s64 tv_usec;

-- 
Ben Hutchings, Software Developer                         Codethink Ltd
https://www.codethink.co.uk/                 Dale House, 35 Dale Street
                                     Manchester, M1 2HF, United Kingdom
Arnd Bergmann Nov. 21, 2019, 2:17 p.m. | #3
On Wed, Nov 20, 2019 at 11:30 PM Ben Hutchings
<ben.hutchings@codethink.co.uk> wrote:
>

> On Fri, 2019-11-08 at 22:07 +0100, Arnd Bergmann wrote:

> > The 'struct timespec' definition can no longer be part of the uapi headers

> > because it conflicts with a a now incompatible libc definition. Also,

> > we really want to remove it in order to prevent new uses from creeping in.

> >

> > The same namespace conflict exists with time_t, which should also be

> > removed. __kernel_time_t could be used safely, but adding 'old' in the

> > name makes it clearer that this should not be used for new interfaces.

> >

> > Add a replacement __kernel_old_timespec structure and __kernel_old_time_t

> > along the lines of __kernel_old_timeval.

> [...]

> > --- a/include/uapi/linux/time_types.h

> > +++ b/include/uapi/linux/time_types.h

> > @@ -28,6 +28,11 @@ struct __kernel_old_timeval {

> >  };

> >  #endif

> >

> > +struct __kernel_old_timespec {

> > +     __kernel_time_t tv_sec;                 /* seconds */

>

> Should this be __kernel_old_time_t for consistency?


Yes. I had already noticed this and changed it in the current version
of "y2038: uapi: change __kernel_time_t to __kernel_old_time_t".

      Arnd

Patch

diff --git a/include/uapi/asm-generic/posix_types.h b/include/uapi/asm-generic/posix_types.h
index f0733a26ebfc..2f9c80595ba7 100644
--- a/include/uapi/asm-generic/posix_types.h
+++ b/include/uapi/asm-generic/posix_types.h
@@ -86,6 +86,7 @@  typedef struct {
  */
 typedef __kernel_long_t	__kernel_off_t;
 typedef long long	__kernel_loff_t;
+typedef __kernel_long_t	__kernel_old_time_t;
 typedef __kernel_long_t	__kernel_time_t;
 typedef long long __kernel_time64_t;
 typedef __kernel_long_t	__kernel_clock_t;
diff --git a/include/uapi/linux/time_types.h b/include/uapi/linux/time_types.h
index 27bfc8fc6904..60b37f29842d 100644
--- a/include/uapi/linux/time_types.h
+++ b/include/uapi/linux/time_types.h
@@ -28,6 +28,11 @@  struct __kernel_old_timeval {
 };
 #endif
 
+struct __kernel_old_timespec {
+	__kernel_time_t	tv_sec;			/* seconds */
+	long		tv_nsec;		/* nanoseconds */
+};
+
 struct __kernel_sock_timeval {
 	__s64 tv_sec;
 	__s64 tv_usec;