[02/16] linux: Define STAT64_IS_KERNEL_STAT64

Message ID 20200723194641.1949404-3-adhemerval.zanella@linaro.org
State New
Headers show
Series
  • Add y2038 support for stat functions
Related show

Commit Message

Will Deacon via Libc-alpha July 23, 2020, 7:46 p.m.
It indicates that the glibc export stat64 is similar in size and
layout of the kernel stat64 used on the syscall.  It is not currently
used on stat implementation, but the idea is to indicate whether
to use the kernel_stat to issue on the syscall on the *stat*64
variant (more specifically on mips which its exported ABI does not
match the kernel).
---
 sysdeps/unix/sysv/linux/alpha/kernel_stat.h             | 1 +
 sysdeps/unix/sysv/linux/arc/kernel_stat.h               | 1 +
 sysdeps/unix/sysv/linux/hppa/kernel_stat.h              | 1 +
 sysdeps/unix/sysv/linux/ia64/kernel_stat.h              | 1 +
 sysdeps/unix/sysv/linux/kernel_stat.h                   | 1 +
 sysdeps/unix/sysv/linux/microblaze/kernel_stat.h        | 1 +
 sysdeps/unix/sysv/linux/mips/kernel_stat.h              | 6 ++++++
 sysdeps/unix/sysv/linux/powerpc/powerpc32/kernel_stat.h | 1 +
 sysdeps/unix/sysv/linux/powerpc/powerpc64/kernel_stat.h | 1 +
 sysdeps/unix/sysv/linux/s390/s390-64/kernel_stat.h      | 1 +
 sysdeps/unix/sysv/linux/sparc/sparc32/kernel_stat.h     | 1 +
 sysdeps/unix/sysv/linux/sparc/sparc64/kernel_stat.h     | 6 ++++++
 sysdeps/unix/sysv/linux/x86_64/kernel_stat.h            | 1 +
 13 files changed, 23 insertions(+)

-- 
2.25.1

Comments

Lukasz Majewski July 24, 2020, 8:20 a.m. | #1
On Thu, 23 Jul 2020 16:46:27 -0300
Adhemerval Zanella <adhemerval.zanella@linaro.org> wrote:

> It indicates that the glibc export stat64 is similar in size and

> layout of the kernel stat64 used on the syscall.  It is not currently

> used on stat implementation, but the idea is to indicate whether

> to use the kernel_stat to issue on the syscall on the *stat*64

> variant (more specifically on mips which its exported ABI does not

> match the kernel).


Reviewed-by: Lukasz Majewski <lukma@denx.de>


> ---

>  sysdeps/unix/sysv/linux/alpha/kernel_stat.h             | 1 +

>  sysdeps/unix/sysv/linux/arc/kernel_stat.h               | 1 +

>  sysdeps/unix/sysv/linux/hppa/kernel_stat.h              | 1 +

>  sysdeps/unix/sysv/linux/ia64/kernel_stat.h              | 1 +

>  sysdeps/unix/sysv/linux/kernel_stat.h                   | 1 +

>  sysdeps/unix/sysv/linux/microblaze/kernel_stat.h        | 1 +

>  sysdeps/unix/sysv/linux/mips/kernel_stat.h              | 6 ++++++

>  sysdeps/unix/sysv/linux/powerpc/powerpc32/kernel_stat.h | 1 +

>  sysdeps/unix/sysv/linux/powerpc/powerpc64/kernel_stat.h | 1 +

>  sysdeps/unix/sysv/linux/s390/s390-64/kernel_stat.h      | 1 +

>  sysdeps/unix/sysv/linux/sparc/sparc32/kernel_stat.h     | 1 +

>  sysdeps/unix/sysv/linux/sparc/sparc64/kernel_stat.h     | 6 ++++++

>  sysdeps/unix/sysv/linux/x86_64/kernel_stat.h            | 1 +

>  13 files changed, 23 insertions(+)

> 

> diff --git a/sysdeps/unix/sysv/linux/alpha/kernel_stat.h

> b/sysdeps/unix/sysv/linux/alpha/kernel_stat.h index

> 9bcc96c577..ff69045f8f 100644 ---

> a/sysdeps/unix/sysv/linux/alpha/kernel_stat.h +++

> b/sysdeps/unix/sysv/linux/alpha/kernel_stat.h @@ -86,5 +86,6 @@

> struct glibc21_stat };

>  

>  #define STAT_IS_KERNEL_STAT 0

> +#define STAT64_IS_KERNEL_STAT64 1

>  #define XSTAT_IS_XSTAT64 1

>  #define STATFS_IS_STATFS64 0

> diff --git a/sysdeps/unix/sysv/linux/arc/kernel_stat.h

> b/sysdeps/unix/sysv/linux/arc/kernel_stat.h index

> 8fdd86b9e8..fd9b113f45 100644 ---

> a/sysdeps/unix/sysv/linux/arc/kernel_stat.h +++

> b/sysdeps/unix/sysv/linux/arc/kernel_stat.h @@ -19,6 +19,7 @@

>  

>  /* Needed to elide the itemized copy code in common xstatconv.c.  */

>  #define STAT_IS_KERNEL_STAT 1

> +#define STAT64_IS_KERNEL_STAT64 1

>  

>  /* Nice side-effect of 64-bit time_t switch is these are same.  */

>  #define XSTAT_IS_XSTAT64 1

> diff --git a/sysdeps/unix/sysv/linux/hppa/kernel_stat.h

> b/sysdeps/unix/sysv/linux/hppa/kernel_stat.h index

> 0cbd010fc3..e8ad135e70 100644 ---

> a/sysdeps/unix/sysv/linux/hppa/kernel_stat.h +++

> b/sysdeps/unix/sysv/linux/hppa/kernel_stat.h @@ -31,5 +31,6 @@ struct

> kernel_stat { #define _HAVE_STAT64_NSEC

>  

>  #define STAT_IS_KERNEL_STAT 0

> +#define STAT64_IS_KERNEL_STAT64 1

>  #define XSTAT_IS_XSTAT64 0

>  #define STATFS_IS_STATFS64 0

> diff --git a/sysdeps/unix/sysv/linux/ia64/kernel_stat.h

> b/sysdeps/unix/sysv/linux/ia64/kernel_stat.h index

> b38bf741d3..c96a0589dc 100644 ---

> a/sysdeps/unix/sysv/linux/ia64/kernel_stat.h +++

> b/sysdeps/unix/sysv/linux/ia64/kernel_stat.h @@ -17,5 +17,6 @@

>     <https://www.gnu.org/licenses/>.  */

>  

>  #define STAT_IS_KERNEL_STAT 1

> +#define STAT64_IS_KERNEL_STAT64 1

>  #define XSTAT_IS_XSTAT64 1

>  #define STATFS_IS_STATFS64 0

> diff --git a/sysdeps/unix/sysv/linux/kernel_stat.h

> b/sysdeps/unix/sysv/linux/kernel_stat.h index ff54a4524c..b1bc1459f0

> 100644 --- a/sysdeps/unix/sysv/linux/kernel_stat.h

> +++ b/sysdeps/unix/sysv/linux/kernel_stat.h

> @@ -35,5 +35,6 @@ struct kernel_stat

>  #define _HAVE_STAT64_NSEC

>  

>  #define STAT_IS_KERNEL_STAT 0

> +#define STAT64_IS_KERNEL_STAT64 1

>  #define XSTAT_IS_XSTAT64 0

>  #define STATFS_IS_STATFS64 0

> diff --git a/sysdeps/unix/sysv/linux/microblaze/kernel_stat.h

> b/sysdeps/unix/sysv/linux/microblaze/kernel_stat.h index

> 4daaedc4b6..9ab1e50115 100644 ---

> a/sysdeps/unix/sysv/linux/microblaze/kernel_stat.h +++

> b/sysdeps/unix/sysv/linux/microblaze/kernel_stat.h @@ -49,5 +49,6 @@

> struct kernel_stat };

>  

>  #define STAT_IS_KERNEL_STAT 0

> +#define STAT64_IS_KERNEL_STAT64 1

>  #define XSTAT_IS_XSTAT64 0

>  #define STATFS_IS_STATFS64 0

> diff --git a/sysdeps/unix/sysv/linux/mips/kernel_stat.h

> b/sysdeps/unix/sysv/linux/mips/kernel_stat.h index

> e75f3e805b..21dba2de73 100644 ---

> a/sysdeps/unix/sysv/linux/mips/kernel_stat.h +++

> b/sysdeps/unix/sysv/linux/mips/kernel_stat.h @@ -1,3 +1,6 @@

> +#ifndef _KERNEL_STAT_H

> +#define _KERNEL_STAT_H

> +

>  #include <sgidefs.h>

>  /* As tempting as it is to define XSTAT_IS_XSTAT64 for n64, the

>     userland data structures are not identical, because of different

> @@ -57,5 +60,8 @@ struct kernel_stat

>  #endif

>  

>  #define STAT_IS_KERNEL_STAT 0

> +#define STAT64_IS_KERNEL_STAT64 0

>  #define XSTAT_IS_XSTAT64 0

>  #define STATFS_IS_STATFS64 0

> +

> +#endif

> diff --git a/sysdeps/unix/sysv/linux/powerpc/powerpc32/kernel_stat.h

> b/sysdeps/unix/sysv/linux/powerpc/powerpc32/kernel_stat.h index

> 75610b8df3..5757e65f8e 100644 ---

> a/sysdeps/unix/sysv/linux/powerpc/powerpc32/kernel_stat.h +++

> b/sysdeps/unix/sysv/linux/powerpc/powerpc32/kernel_stat.h @@ -48,5

> +48,6 @@ struct kernel_stat #define _HAVE_STAT64_NSEC

>  

>  #define STAT_IS_KERNEL_STAT 0

> +#define STAT64_IS_KERNEL_STAT64 1

>  #define XSTAT_IS_XSTAT64 0

>  #define STATFS_IS_STATFS64 0

> diff --git a/sysdeps/unix/sysv/linux/powerpc/powerpc64/kernel_stat.h

> b/sysdeps/unix/sysv/linux/powerpc/powerpc64/kernel_stat.h index

> 5c10da3356..9f11b69e4f 100644 ---

> a/sysdeps/unix/sysv/linux/powerpc/powerpc64/kernel_stat.h +++

> b/sysdeps/unix/sysv/linux/powerpc/powerpc64/kernel_stat.h @@ -17,5

> +17,6 @@ <https://www.gnu.org/licenses/>.  */

>  

>  #define STAT_IS_KERNEL_STAT 1

> +#define STAT64_IS_KERNEL_STAT64 1

>  #define XSTAT_IS_XSTAT64 1

>  #define STATFS_IS_STATFS64 0

> diff --git a/sysdeps/unix/sysv/linux/s390/s390-64/kernel_stat.h

> b/sysdeps/unix/sysv/linux/s390/s390-64/kernel_stat.h index

> b38bf741d3..c96a0589dc 100644 ---

> a/sysdeps/unix/sysv/linux/s390/s390-64/kernel_stat.h +++

> b/sysdeps/unix/sysv/linux/s390/s390-64/kernel_stat.h @@ -17,5 +17,6 @@

>     <https://www.gnu.org/licenses/>.  */

>  

>  #define STAT_IS_KERNEL_STAT 1

> +#define STAT64_IS_KERNEL_STAT64 1

>  #define XSTAT_IS_XSTAT64 1

>  #define STATFS_IS_STATFS64 0

> diff --git a/sysdeps/unix/sysv/linux/sparc/sparc32/kernel_stat.h

> b/sysdeps/unix/sysv/linux/sparc/sparc32/kernel_stat.h index

> 5c8cacaf67..4a2df42d37 100644 ---

> a/sysdeps/unix/sysv/linux/sparc/sparc32/kernel_stat.h +++

> b/sysdeps/unix/sysv/linux/sparc/sparc32/kernel_stat.h @@ -32,5 +32,6

> @@ struct kernel_stat #define _HAVE_STAT64_NSEC

>  

>  #define STAT_IS_KERNEL_STAT 0

> +#define STAT64_IS_KERNEL_STAT64 1

>  #define XSTAT_IS_XSTAT64 0

>  #define STATFS_IS_STATFS64 0

> diff --git a/sysdeps/unix/sysv/linux/sparc/sparc64/kernel_stat.h

> b/sysdeps/unix/sysv/linux/sparc/sparc64/kernel_stat.h index

> d14b2487ac..0f3d405239 100644 ---

> a/sysdeps/unix/sysv/linux/sparc/sparc64/kernel_stat.h +++

> b/sysdeps/unix/sysv/linux/sparc/sparc64/kernel_stat.h @@ -1,3 +1,6 @@

> +#ifndef _KERNEL_STAT_H

> +#define _KERNEL_STAT_H

> +

>  /* Definition of `struct stat' used in the kernel */

>  struct kernel_stat

>    {

> @@ -45,5 +48,8 @@ struct kernel_stat64

>    };

>  

>  #define STAT_IS_KERNEL_STAT 0

> +#define STAT64_IS_KERNEL_STAT64 0

>  #define XSTAT_IS_XSTAT64 1

>  #define STATFS_IS_STATFS64 0

> +

> +#endif /* _KERNEL_STAT_H  */

> diff --git a/sysdeps/unix/sysv/linux/x86_64/kernel_stat.h

> b/sysdeps/unix/sysv/linux/x86_64/kernel_stat.h index

> b38bf741d3..c96a0589dc 100644 ---

> a/sysdeps/unix/sysv/linux/x86_64/kernel_stat.h +++

> b/sysdeps/unix/sysv/linux/x86_64/kernel_stat.h @@ -17,5 +17,6 @@

>     <https://www.gnu.org/licenses/>.  */

>  

>  #define STAT_IS_KERNEL_STAT 1

> +#define STAT64_IS_KERNEL_STAT64 1

>  #define XSTAT_IS_XSTAT64 1

>  #define STATFS_IS_STATFS64 0





Best regards,

Lukasz Majewski

--

DENX Software Engineering GmbH,      Managing Director: Wolfgang Denk
HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany
Phone: (+49)-8142-66989-59 Fax: (+49)-8142-66989-80 Email: lukma@denx.de

Patch

diff --git a/sysdeps/unix/sysv/linux/alpha/kernel_stat.h b/sysdeps/unix/sysv/linux/alpha/kernel_stat.h
index 9bcc96c577..ff69045f8f 100644
--- a/sysdeps/unix/sysv/linux/alpha/kernel_stat.h
+++ b/sysdeps/unix/sysv/linux/alpha/kernel_stat.h
@@ -86,5 +86,6 @@  struct glibc21_stat
   };
 
 #define STAT_IS_KERNEL_STAT 0
+#define STAT64_IS_KERNEL_STAT64 1
 #define XSTAT_IS_XSTAT64 1
 #define STATFS_IS_STATFS64 0
diff --git a/sysdeps/unix/sysv/linux/arc/kernel_stat.h b/sysdeps/unix/sysv/linux/arc/kernel_stat.h
index 8fdd86b9e8..fd9b113f45 100644
--- a/sysdeps/unix/sysv/linux/arc/kernel_stat.h
+++ b/sysdeps/unix/sysv/linux/arc/kernel_stat.h
@@ -19,6 +19,7 @@ 
 
 /* Needed to elide the itemized copy code in common xstatconv.c.  */
 #define STAT_IS_KERNEL_STAT 1
+#define STAT64_IS_KERNEL_STAT64 1
 
 /* Nice side-effect of 64-bit time_t switch is these are same.  */
 #define XSTAT_IS_XSTAT64 1
diff --git a/sysdeps/unix/sysv/linux/hppa/kernel_stat.h b/sysdeps/unix/sysv/linux/hppa/kernel_stat.h
index 0cbd010fc3..e8ad135e70 100644
--- a/sysdeps/unix/sysv/linux/hppa/kernel_stat.h
+++ b/sysdeps/unix/sysv/linux/hppa/kernel_stat.h
@@ -31,5 +31,6 @@  struct kernel_stat {
 #define _HAVE_STAT64_NSEC
 
 #define STAT_IS_KERNEL_STAT 0
+#define STAT64_IS_KERNEL_STAT64 1
 #define XSTAT_IS_XSTAT64 0
 #define STATFS_IS_STATFS64 0
diff --git a/sysdeps/unix/sysv/linux/ia64/kernel_stat.h b/sysdeps/unix/sysv/linux/ia64/kernel_stat.h
index b38bf741d3..c96a0589dc 100644
--- a/sysdeps/unix/sysv/linux/ia64/kernel_stat.h
+++ b/sysdeps/unix/sysv/linux/ia64/kernel_stat.h
@@ -17,5 +17,6 @@ 
    <https://www.gnu.org/licenses/>.  */
 
 #define STAT_IS_KERNEL_STAT 1
+#define STAT64_IS_KERNEL_STAT64 1
 #define XSTAT_IS_XSTAT64 1
 #define STATFS_IS_STATFS64 0
diff --git a/sysdeps/unix/sysv/linux/kernel_stat.h b/sysdeps/unix/sysv/linux/kernel_stat.h
index ff54a4524c..b1bc1459f0 100644
--- a/sysdeps/unix/sysv/linux/kernel_stat.h
+++ b/sysdeps/unix/sysv/linux/kernel_stat.h
@@ -35,5 +35,6 @@  struct kernel_stat
 #define _HAVE_STAT64_NSEC
 
 #define STAT_IS_KERNEL_STAT 0
+#define STAT64_IS_KERNEL_STAT64 1
 #define XSTAT_IS_XSTAT64 0
 #define STATFS_IS_STATFS64 0
diff --git a/sysdeps/unix/sysv/linux/microblaze/kernel_stat.h b/sysdeps/unix/sysv/linux/microblaze/kernel_stat.h
index 4daaedc4b6..9ab1e50115 100644
--- a/sysdeps/unix/sysv/linux/microblaze/kernel_stat.h
+++ b/sysdeps/unix/sysv/linux/microblaze/kernel_stat.h
@@ -49,5 +49,6 @@  struct kernel_stat
 };
 
 #define STAT_IS_KERNEL_STAT 0
+#define STAT64_IS_KERNEL_STAT64 1
 #define XSTAT_IS_XSTAT64 0
 #define STATFS_IS_STATFS64 0
diff --git a/sysdeps/unix/sysv/linux/mips/kernel_stat.h b/sysdeps/unix/sysv/linux/mips/kernel_stat.h
index e75f3e805b..21dba2de73 100644
--- a/sysdeps/unix/sysv/linux/mips/kernel_stat.h
+++ b/sysdeps/unix/sysv/linux/mips/kernel_stat.h
@@ -1,3 +1,6 @@ 
+#ifndef _KERNEL_STAT_H
+#define _KERNEL_STAT_H
+
 #include <sgidefs.h>
 /* As tempting as it is to define XSTAT_IS_XSTAT64 for n64, the
    userland data structures are not identical, because of different
@@ -57,5 +60,8 @@  struct kernel_stat
 #endif
 
 #define STAT_IS_KERNEL_STAT 0
+#define STAT64_IS_KERNEL_STAT64 0
 #define XSTAT_IS_XSTAT64 0
 #define STATFS_IS_STATFS64 0
+
+#endif
diff --git a/sysdeps/unix/sysv/linux/powerpc/powerpc32/kernel_stat.h b/sysdeps/unix/sysv/linux/powerpc/powerpc32/kernel_stat.h
index 75610b8df3..5757e65f8e 100644
--- a/sysdeps/unix/sysv/linux/powerpc/powerpc32/kernel_stat.h
+++ b/sysdeps/unix/sysv/linux/powerpc/powerpc32/kernel_stat.h
@@ -48,5 +48,6 @@  struct kernel_stat
 #define _HAVE_STAT64_NSEC
 
 #define STAT_IS_KERNEL_STAT 0
+#define STAT64_IS_KERNEL_STAT64 1
 #define XSTAT_IS_XSTAT64 0
 #define STATFS_IS_STATFS64 0
diff --git a/sysdeps/unix/sysv/linux/powerpc/powerpc64/kernel_stat.h b/sysdeps/unix/sysv/linux/powerpc/powerpc64/kernel_stat.h
index 5c10da3356..9f11b69e4f 100644
--- a/sysdeps/unix/sysv/linux/powerpc/powerpc64/kernel_stat.h
+++ b/sysdeps/unix/sysv/linux/powerpc/powerpc64/kernel_stat.h
@@ -17,5 +17,6 @@ 
    <https://www.gnu.org/licenses/>.  */
 
 #define STAT_IS_KERNEL_STAT 1
+#define STAT64_IS_KERNEL_STAT64 1
 #define XSTAT_IS_XSTAT64 1
 #define STATFS_IS_STATFS64 0
diff --git a/sysdeps/unix/sysv/linux/s390/s390-64/kernel_stat.h b/sysdeps/unix/sysv/linux/s390/s390-64/kernel_stat.h
index b38bf741d3..c96a0589dc 100644
--- a/sysdeps/unix/sysv/linux/s390/s390-64/kernel_stat.h
+++ b/sysdeps/unix/sysv/linux/s390/s390-64/kernel_stat.h
@@ -17,5 +17,6 @@ 
    <https://www.gnu.org/licenses/>.  */
 
 #define STAT_IS_KERNEL_STAT 1
+#define STAT64_IS_KERNEL_STAT64 1
 #define XSTAT_IS_XSTAT64 1
 #define STATFS_IS_STATFS64 0
diff --git a/sysdeps/unix/sysv/linux/sparc/sparc32/kernel_stat.h b/sysdeps/unix/sysv/linux/sparc/sparc32/kernel_stat.h
index 5c8cacaf67..4a2df42d37 100644
--- a/sysdeps/unix/sysv/linux/sparc/sparc32/kernel_stat.h
+++ b/sysdeps/unix/sysv/linux/sparc/sparc32/kernel_stat.h
@@ -32,5 +32,6 @@  struct kernel_stat
 #define _HAVE_STAT64_NSEC
 
 #define STAT_IS_KERNEL_STAT 0
+#define STAT64_IS_KERNEL_STAT64 1
 #define XSTAT_IS_XSTAT64 0
 #define STATFS_IS_STATFS64 0
diff --git a/sysdeps/unix/sysv/linux/sparc/sparc64/kernel_stat.h b/sysdeps/unix/sysv/linux/sparc/sparc64/kernel_stat.h
index d14b2487ac..0f3d405239 100644
--- a/sysdeps/unix/sysv/linux/sparc/sparc64/kernel_stat.h
+++ b/sysdeps/unix/sysv/linux/sparc/sparc64/kernel_stat.h
@@ -1,3 +1,6 @@ 
+#ifndef _KERNEL_STAT_H
+#define _KERNEL_STAT_H
+
 /* Definition of `struct stat' used in the kernel */
 struct kernel_stat
   {
@@ -45,5 +48,8 @@  struct kernel_stat64
   };
 
 #define STAT_IS_KERNEL_STAT 0
+#define STAT64_IS_KERNEL_STAT64 0
 #define XSTAT_IS_XSTAT64 1
 #define STATFS_IS_STATFS64 0
+
+#endif /* _KERNEL_STAT_H  */
diff --git a/sysdeps/unix/sysv/linux/x86_64/kernel_stat.h b/sysdeps/unix/sysv/linux/x86_64/kernel_stat.h
index b38bf741d3..c96a0589dc 100644
--- a/sysdeps/unix/sysv/linux/x86_64/kernel_stat.h
+++ b/sysdeps/unix/sysv/linux/x86_64/kernel_stat.h
@@ -17,5 +17,6 @@ 
    <https://www.gnu.org/licenses/>.  */
 
 #define STAT_IS_KERNEL_STAT 1
+#define STAT64_IS_KERNEL_STAT64 1
 #define XSTAT_IS_XSTAT64 1
 #define STATFS_IS_STATFS64 0