[1/3] y2038: Introduce struct __utimbuf64 - new internal glibc type

Message ID 20200207130009.19396-2-lukma@denx.de
State Committed
Headers

Commit Message

Lukasz Majewski Feb. 7, 2020, 1 p.m. UTC
  This type is a glibc's "internal" type to store file's access and modification
times in __time64_t rather than __time_t, which makes it Y2038-proof.

Build tests:
./src/scripts/build-many-glibcs.py glibcs
---
 include/time.h | 12 ++++++++++++
 1 file changed, 12 insertions(+)
  

Comments

Alistair Francis Feb. 7, 2020, 8:52 p.m. UTC | #1
On Fri, Feb 7, 2020 at 5:00 AM Lukasz Majewski <lukma@denx.de> wrote:
>
> This type is a glibc's "internal" type to store file's access and modification
> times in __time64_t rather than __time_t, which makes it Y2038-proof.
>
> Build tests:
> ./src/scripts/build-many-glibcs.py glibcs

Reviewed-by: Alistair Francis <alistair.francis@wdc.com>

Alistair

> ---
>  include/time.h | 12 ++++++++++++
>  1 file changed, 12 insertions(+)
>
> diff --git a/include/time.h b/include/time.h
> index 389355a5a5..e38f5e32e6 100644
> --- a/include/time.h
> +++ b/include/time.h
> @@ -109,6 +109,18 @@ struct __timeval64
>  };
>  #endif
>
> +#if __TIMESIZE == 64
> +# define __utimbuf64 utimbuf
> +#else
> +/* The glibc Y2038-proof struct __utimbuf64 structure for file's access
> +   and modification time values.  */
> +struct __utimbuf64
> +{
> +  __time64_t actime;           /* Access time.  */
> +  __time64_t modtime;          /* Modification time.  */
> +};
> +#endif
> +
>  #if __TIMESIZE == 64
>  # define __itimerval64 itimerval
>  #else
> --
> 2.20.1
>
  
Adhemerval Zanella Feb. 20, 2020, 2:53 p.m. UTC | #2
On 07/02/2020 10:00, Lukasz Majewski wrote:
> This type is a glibc's "internal" type to store file's access and modification
> times in __time64_t rather than __time_t, which makes it Y2038-proof.
> 
> Build tests:
> ./src/scripts/build-many-glibcs.py glibcs

LGTM, thanks.

Reviewed-by: Adhemerval Zanella <adhemerval.zanella@linaro.org>

> ---
>  include/time.h | 12 ++++++++++++
>  1 file changed, 12 insertions(+)
> 
> diff --git a/include/time.h b/include/time.h
> index 389355a5a5..e38f5e32e6 100644
> --- a/include/time.h
> +++ b/include/time.h
> @@ -109,6 +109,18 @@ struct __timeval64
>  };
>  #endif
>  
> +#if __TIMESIZE == 64
> +# define __utimbuf64 utimbuf
> +#else
> +/* The glibc Y2038-proof struct __utimbuf64 structure for file's access
> +   and modification time values.  */
> +struct __utimbuf64
> +{
> +  __time64_t actime;		/* Access time.  */
> +  __time64_t modtime;		/* Modification time.  */
> +};
> +#endif
> +
>  #if __TIMESIZE == 64
>  # define __itimerval64 itimerval
>  #else
> 

Ok.
  

Patch

diff --git a/include/time.h b/include/time.h
index 389355a5a5..e38f5e32e6 100644
--- a/include/time.h
+++ b/include/time.h
@@ -109,6 +109,18 @@  struct __timeval64
 };
 #endif
 
+#if __TIMESIZE == 64
+# define __utimbuf64 utimbuf
+#else
+/* The glibc Y2038-proof struct __utimbuf64 structure for file's access
+   and modification time values.  */
+struct __utimbuf64
+{
+  __time64_t actime;		/* Access time.  */
+  __time64_t modtime;		/* Modification time.  */
+};
+#endif
+
 #if __TIMESIZE == 64
 # define __itimerval64 itimerval
 #else