6ca6e8
commit ca5df795459b9242cd7d787ebf71a09be2244577
6ca6e8
Author: Adhemerval Zanella <adhemerval.zanella@linaro.org>
6ca6e8
Date:   Wed Oct 19 19:14:04 2022 -0300
6ca6e8
6ca6e8
    linux: Fix generic struct_stat for 64 bit time (BZ# 29657)
6ca6e8
    
6ca6e8
    The generic Linux struct_stat misses the conditionals to use
6ca6e8
    bits/struct_stat_time64_helper.h in the __USE_TIME_BITS64 for
6ca6e8
    architecture that uses __TIMESIZE == 32 (currently csky and nios2).
6ca6e8
    
6ca6e8
    Since newer ports should not support 32 bit time_t, the generic
6ca6e8
    implementation should be used as default.
6ca6e8
    
6ca6e8
    For arm, hppa, and sh a copy of default struct_stat is added,
6ca6e8
    while for csky and nios a new one based on generic is used, along
6ca6e8
    with conditionals to use bits/struct_stat_time64_helper.h.
6ca6e8
    
6ca6e8
    The default struct_stat is also replaced with the generic one.
6ca6e8
    
6ca6e8
    Checked on aarch64-linux-gnu and arm-linux-gnueabihf.
6ca6e8
    
6ca6e8
    (cherry picked from commit 7a6ca82f8007ddbd43e2b8fce806ba7101ee47f5)
6ca6e8
6ca6e8
diff --git a/sysdeps/unix/sysv/linux/arm/bits/struct_stat.h b/sysdeps/unix/sysv/linux/arm/bits/struct_stat.h
6ca6e8
new file mode 100644
6ca6e8
index 0000000000000000..30ee6279d2701242
6ca6e8
--- /dev/null
6ca6e8
+++ b/sysdeps/unix/sysv/linux/arm/bits/struct_stat.h
6ca6e8
@@ -0,0 +1,139 @@
6ca6e8
+/* Definition for struct stat.  Linux/arm version.
6ca6e8
+   Copyright (C) 2020-2022 Free Software Foundation, Inc.
6ca6e8
+   This file is part of the GNU C Library.
6ca6e8
+
6ca6e8
+   The GNU C Library is free software; you can redistribute it and/or
6ca6e8
+   modify it under the terms of the GNU Lesser General Public
6ca6e8
+   License as published by the Free Software Foundation; either
6ca6e8
+   version 2.1 of the License, or (at your option) any later version.
6ca6e8
+
6ca6e8
+   The GNU C Library is distributed in the hope that it will be useful,
6ca6e8
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
6ca6e8
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
6ca6e8
+   Lesser General Public License for more details.
6ca6e8
+
6ca6e8
+   You should have received a copy of the GNU Lesser General Public
6ca6e8
+   License along with the GNU C Library.  If not, see
6ca6e8
+   <https://www.gnu.org/licenses/>.  */
6ca6e8
+
6ca6e8
+#if !defined _SYS_STAT_H && !defined _FCNTL_H
6ca6e8
+# error "Never include <bits/struct_stat.h> directly; use <sys/stat.h> instead."
6ca6e8
+#endif
6ca6e8
+
6ca6e8
+#ifndef _BITS_STRUCT_STAT_H
6ca6e8
+#define _BITS_STRUCT_STAT_H	1
6ca6e8
+
6ca6e8
+#include <bits/endian.h>
6ca6e8
+#include <bits/wordsize.h>
6ca6e8
+
6ca6e8
+struct stat
6ca6e8
+  {
6ca6e8
+#ifdef __USE_TIME_BITS64
6ca6e8
+# include <bits/struct_stat_time64_helper.h>
6ca6e8
+#else
6ca6e8
+    __dev_t st_dev;			/* Device.  */
6ca6e8
+    unsigned short int __pad1;
6ca6e8
+# ifndef __USE_FILE_OFFSET64
6ca6e8
+    __ino_t st_ino;			/* File serial number.	*/
6ca6e8
+# else
6ca6e8
+    __ino_t __st_ino;			/* 32bit file serial number.	*/
6ca6e8
+# endif
6ca6e8
+    __mode_t st_mode;			/* File mode.  */
6ca6e8
+    __nlink_t st_nlink;			/* Link count.  */
6ca6e8
+    __uid_t st_uid;			/* User ID of the file's owner.	*/
6ca6e8
+    __gid_t st_gid;			/* Group ID of the file's group.*/
6ca6e8
+    __dev_t st_rdev;			/* Device number, if device.  */
6ca6e8
+    unsigned short int __pad2;
6ca6e8
+# ifndef __USE_FILE_OFFSET64
6ca6e8
+    __off_t st_size;			/* Size of file, in bytes.  */
6ca6e8
+# else
6ca6e8
+    __off64_t st_size;			/* Size of file, in bytes.  */
6ca6e8
+# endif
6ca6e8
+    __blksize_t st_blksize;		/* Optimal block size for I/O.  */
6ca6e8
+
6ca6e8
+# ifndef __USE_FILE_OFFSET64
6ca6e8
+    __blkcnt_t st_blocks;		/* Number 512-byte blocks allocated. */
6ca6e8
+# else
6ca6e8
+    __blkcnt64_t st_blocks;		/* Number 512-byte blocks allocated. */
6ca6e8
+# endif
6ca6e8
+# ifdef __USE_XOPEN2K8
6ca6e8
+    /* Nanosecond resolution timestamps are stored in a format
6ca6e8
+       equivalent to 'struct timespec'.  This is the type used
6ca6e8
+       whenever possible but the Unix namespace rules do not allow the
6ca6e8
+       identifier 'timespec' to appear in the <sys/stat.h> header.
6ca6e8
+       Therefore we have to handle the use of this header in strictly
6ca6e8
+       standard-compliant sources special.  */
6ca6e8
+    struct timespec st_atim;		/* Time of last access.  */
6ca6e8
+    struct timespec st_mtim;		/* Time of last modification.  */
6ca6e8
+    struct timespec st_ctim;		/* Time of last status change.  */
6ca6e8
+#  define st_atime st_atim.tv_sec	/* Backward compatibility.  */
6ca6e8
+#  define st_mtime st_mtim.tv_sec
6ca6e8
+#  define st_ctime st_ctim.tv_sec
6ca6e8
+# else
6ca6e8
+    __time_t st_atime;			/* Time of last access.  */
6ca6e8
+    unsigned long int st_atimensec;	/* Nscecs of last access.  */
6ca6e8
+    __time_t st_mtime;			/* Time of last modification.  */
6ca6e8
+    unsigned long int st_mtimensec;	/* Nsecs of last modification.  */
6ca6e8
+    __time_t st_ctime;			/* Time of last status change.  */
6ca6e8
+    unsigned long int st_ctimensec;	/* Nsecs of last status change.  */
6ca6e8
+# endif
6ca6e8
+# ifndef __USE_FILE_OFFSET64
6ca6e8
+    unsigned long int __glibc_reserved4;
6ca6e8
+    unsigned long int __glibc_reserved5;
6ca6e8
+# else
6ca6e8
+    __ino64_t st_ino;			/* File serial number.	*/
6ca6e8
+# endif
6ca6e8
+#endif /* __USE_TIME_BITS64  */
6ca6e8
+  };
6ca6e8
+
6ca6e8
+#ifdef __USE_LARGEFILE64
6ca6e8
+struct stat64
6ca6e8
+  {
6ca6e8
+# ifdef __USE_TIME_BITS64
6ca6e8
+#  include <bits/struct_stat_time64_helper.h>
6ca6e8
+# else
6ca6e8
+    __dev_t st_dev;			/* Device.  */
6ca6e8
+    unsigned int __pad1;
6ca6e8
+
6ca6e8
+    __ino_t __st_ino;			/* 32bit file serial number.	*/
6ca6e8
+    __mode_t st_mode;			/* File mode.  */
6ca6e8
+    __nlink_t st_nlink;			/* Link count.  */
6ca6e8
+    __uid_t st_uid;			/* User ID of the file's owner.	*/
6ca6e8
+    __gid_t st_gid;			/* Group ID of the file's group.*/
6ca6e8
+    __dev_t st_rdev;			/* Device number, if device.  */
6ca6e8
+    unsigned int __pad2;
6ca6e8
+    __off64_t st_size;			/* Size of file, in bytes.  */
6ca6e8
+    __blksize_t st_blksize;		/* Optimal block size for I/O.  */
6ca6e8
+
6ca6e8
+    __blkcnt64_t st_blocks;		/* Number 512-byte blocks allocated. */
6ca6e8
+#  ifdef __USE_XOPEN2K8
6ca6e8
+    /* Nanosecond resolution timestamps are stored in a format
6ca6e8
+       equivalent to 'struct timespec'.  This is the type used
6ca6e8
+       whenever possible but the Unix namespace rules do not allow the
6ca6e8
+       identifier 'timespec' to appear in the <sys/stat.h> header.
6ca6e8
+       Therefore we have to handle the use of this header in strictly
6ca6e8
+       standard-compliant sources special.  */
6ca6e8
+    struct timespec st_atim;		/* Time of last access.  */
6ca6e8
+    struct timespec st_mtim;		/* Time of last modification.  */
6ca6e8
+    struct timespec st_ctim;		/* Time of last status change.  */
6ca6e8
+#  else
6ca6e8
+    __time_t st_atime;			/* Time of last access.  */
6ca6e8
+    unsigned long int st_atimensec;	/* Nscecs of last access.  */
6ca6e8
+    __time_t st_mtime;			/* Time of last modification.  */
6ca6e8
+    unsigned long int st_mtimensec;	/* Nsecs of last modification.  */
6ca6e8
+    __time_t st_ctime;			/* Time of last status change.  */
6ca6e8
+    unsigned long int st_ctimensec;	/* Nsecs of last status change.  */
6ca6e8
+#  endif
6ca6e8
+    __ino64_t st_ino;			/* File serial number.		*/
6ca6e8
+# endif /* __USE_TIME_BITS64  */
6ca6e8
+  };
6ca6e8
+#endif
6ca6e8
+
6ca6e8
+/* Tell code we have these members.  */
6ca6e8
+#define	_STATBUF_ST_BLKSIZE
6ca6e8
+#define _STATBUF_ST_RDEV
6ca6e8
+/* Nanosecond resolution time values are supported.  */
6ca6e8
+#define _STATBUF_ST_NSEC
6ca6e8
+
6ca6e8
+
6ca6e8
+#endif /* _BITS_STRUCT_STAT_H  */
6ca6e8
diff --git a/sysdeps/unix/sysv/linux/bits/struct_stat.h b/sysdeps/unix/sysv/linux/bits/struct_stat.h
6ca6e8
index 298418966f4d6e0b..32ef511ae5728276 100644
6ca6e8
--- a/sysdeps/unix/sysv/linux/bits/struct_stat.h
6ca6e8
+++ b/sysdeps/unix/sysv/linux/bits/struct_stat.h
6ca6e8
@@ -26,37 +26,36 @@
6ca6e8
 #include <bits/endian.h>
6ca6e8
 #include <bits/wordsize.h>
6ca6e8
 
6ca6e8
-struct stat
6ca6e8
-  {
6ca6e8
-#ifdef __USE_TIME_BITS64
6ca6e8
-# include <bits/struct_stat_time64_helper.h>
6ca6e8
-#else
6ca6e8
-    __dev_t st_dev;			/* Device.  */
6ca6e8
-    unsigned short int __pad1;
6ca6e8
-# ifndef __USE_FILE_OFFSET64
6ca6e8
-    __ino_t st_ino;			/* File serial number.	*/
6ca6e8
-# else
6ca6e8
-    __ino_t __st_ino;			/* 32bit file serial number.	*/
6ca6e8
+#if defined __USE_FILE_OFFSET64
6ca6e8
+# define __field64(type, type64, name) type64 name
6ca6e8
+#elif __WORDSIZE == 64 || defined __INO_T_MATCHES_INO64_T
6ca6e8
+# if defined __INO_T_MATCHES_INO64_T && !defined __OFF_T_MATCHES_OFF64_T
6ca6e8
+#  error "ino_t and off_t must both be the same type"
6ca6e8
 # endif
6ca6e8
-    __mode_t st_mode;			/* File mode.  */
6ca6e8
-    __nlink_t st_nlink;			/* Link count.  */
6ca6e8
-    __uid_t st_uid;			/* User ID of the file's owner.	*/
6ca6e8
-    __gid_t st_gid;			/* Group ID of the file's group.*/
6ca6e8
-    __dev_t st_rdev;			/* Device number, if device.  */
6ca6e8
-    unsigned short int __pad2;
6ca6e8
-# ifndef __USE_FILE_OFFSET64
6ca6e8
-    __off_t st_size;			/* Size of file, in bytes.  */
6ca6e8
-# else
6ca6e8
-    __off64_t st_size;			/* Size of file, in bytes.  */
6ca6e8
-# endif
6ca6e8
-    __blksize_t st_blksize;		/* Optimal block size for I/O.  */
6ca6e8
+# define __field64(type, type64, name) type name
6ca6e8
+#elif __BYTE_ORDER == __LITTLE_ENDIAN
6ca6e8
+# define __field64(type, type64, name) \
6ca6e8
+  type name __attribute__((__aligned__ (__alignof__ (type64)))); int __##name##_pad
6ca6e8
+#else
6ca6e8
+# define __field64(type, type64, name) \
6ca6e8
+  int __##name##_pad __attribute__((__aligned__ (__alignof__ (type64)))); type name
6ca6e8
+#endif
6ca6e8
 
6ca6e8
-# ifndef __USE_FILE_OFFSET64
6ca6e8
-    __blkcnt_t st_blocks;		/* Number 512-byte blocks allocated. */
6ca6e8
-# else
6ca6e8
-    __blkcnt64_t st_blocks;		/* Number 512-byte blocks allocated. */
6ca6e8
-# endif
6ca6e8
-# ifdef __USE_XOPEN2K8
6ca6e8
+struct stat
6ca6e8
+  {
6ca6e8
+    __dev_t st_dev;		/* Device.  */
6ca6e8
+    __field64(__ino_t, __ino64_t, st_ino);  /* File serial number. */
6ca6e8
+    __mode_t st_mode;		/* File mode.  */
6ca6e8
+    __nlink_t st_nlink;		/* Link count.  */
6ca6e8
+    __uid_t st_uid;		/* User ID of the file's owner.	*/
6ca6e8
+    __gid_t st_gid;		/* Group ID of the file's group.*/
6ca6e8
+    __dev_t st_rdev;		/* Device number, if device.  */
6ca6e8
+    __dev_t __pad1;
6ca6e8
+    __field64(__off_t, __off64_t, st_size);  /* Size of file, in bytes. */
6ca6e8
+    __blksize_t st_blksize;	/* Optimal block size for I/O.  */
6ca6e8
+    int __pad2;
6ca6e8
+    __field64(__blkcnt_t, __blkcnt64_t, st_blocks);  /* 512-byte blocks */
6ca6e8
+#ifdef __USE_XOPEN2K8
6ca6e8
     /* Nanosecond resolution timestamps are stored in a format
6ca6e8
        equivalent to 'struct timespec'.  This is the type used
6ca6e8
        whenever possible but the Unix namespace rules do not allow the
6ca6e8
@@ -66,47 +65,38 @@ struct stat
6ca6e8
     struct timespec st_atim;		/* Time of last access.  */
6ca6e8
     struct timespec st_mtim;		/* Time of last modification.  */
6ca6e8
     struct timespec st_ctim;		/* Time of last status change.  */
6ca6e8
-#  define st_atime st_atim.tv_sec	/* Backward compatibility.  */
6ca6e8
-#  define st_mtime st_mtim.tv_sec
6ca6e8
-#  define st_ctime st_ctim.tv_sec
6ca6e8
-# else
6ca6e8
+# define st_atime st_atim.tv_sec	/* Backward compatibility.  */
6ca6e8
+# define st_mtime st_mtim.tv_sec
6ca6e8
+# define st_ctime st_ctim.tv_sec
6ca6e8
+#else
6ca6e8
     __time_t st_atime;			/* Time of last access.  */
6ca6e8
     unsigned long int st_atimensec;	/* Nscecs of last access.  */
6ca6e8
     __time_t st_mtime;			/* Time of last modification.  */
6ca6e8
     unsigned long int st_mtimensec;	/* Nsecs of last modification.  */
6ca6e8
     __time_t st_ctime;			/* Time of last status change.  */
6ca6e8
     unsigned long int st_ctimensec;	/* Nsecs of last status change.  */
6ca6e8
-# endif
6ca6e8
-# ifndef __USE_FILE_OFFSET64
6ca6e8
-    unsigned long int __glibc_reserved4;
6ca6e8
-    unsigned long int __glibc_reserved5;
6ca6e8
-# else
6ca6e8
-    __ino64_t st_ino;			/* File serial number.	*/
6ca6e8
-# endif
6ca6e8
-#endif /* __USE_TIME_BITS64  */
6ca6e8
+#endif
6ca6e8
+    int __glibc_reserved[2];
6ca6e8
   };
6ca6e8
 
6ca6e8
+#undef __field64
6ca6e8
+
6ca6e8
 #ifdef __USE_LARGEFILE64
6ca6e8
 struct stat64
6ca6e8
   {
6ca6e8
-# ifdef __USE_TIME_BITS64
6ca6e8
-#  include <bits/struct_stat_time64_helper.h>
6ca6e8
-# else
6ca6e8
-    __dev_t st_dev;			/* Device.  */
6ca6e8
-    unsigned int __pad1;
6ca6e8
-
6ca6e8
-    __ino_t __st_ino;			/* 32bit file serial number.	*/
6ca6e8
-    __mode_t st_mode;			/* File mode.  */
6ca6e8
-    __nlink_t st_nlink;			/* Link count.  */
6ca6e8
-    __uid_t st_uid;			/* User ID of the file's owner.	*/
6ca6e8
-    __gid_t st_gid;			/* Group ID of the file's group.*/
6ca6e8
-    __dev_t st_rdev;			/* Device number, if device.  */
6ca6e8
-    unsigned int __pad2;
6ca6e8
-    __off64_t st_size;			/* Size of file, in bytes.  */
6ca6e8
-    __blksize_t st_blksize;		/* Optimal block size for I/O.  */
6ca6e8
-
6ca6e8
-    __blkcnt64_t st_blocks;		/* Number 512-byte blocks allocated. */
6ca6e8
-#  ifdef __USE_XOPEN2K8
6ca6e8
+    __dev_t st_dev;		/* Device.  */
6ca6e8
+    __ino64_t st_ino;		/* File serial number.	*/
6ca6e8
+    __mode_t st_mode;		/* File mode.  */
6ca6e8
+    __nlink_t st_nlink;		/* Link count.  */
6ca6e8
+    __uid_t st_uid;		/* User ID of the file's owner.	*/
6ca6e8
+    __gid_t st_gid;		/* Group ID of the file's group.*/
6ca6e8
+    __dev_t st_rdev;		/* Device number, if device.  */
6ca6e8
+    __dev_t __pad1;
6ca6e8
+    __off64_t st_size;		/* Size of file, in bytes.  */
6ca6e8
+    __blksize_t st_blksize;	/* Optimal block size for I/O.  */
6ca6e8
+    int __pad2;
6ca6e8
+    __blkcnt64_t st_blocks;	/* Nr. 512-byte blocks allocated.  */
6ca6e8
+#ifdef __USE_XOPEN2K8
6ca6e8
     /* Nanosecond resolution timestamps are stored in a format
6ca6e8
        equivalent to 'struct timespec'.  This is the type used
6ca6e8
        whenever possible but the Unix namespace rules do not allow the
6ca6e8
@@ -116,16 +106,15 @@ struct stat64
6ca6e8
     struct timespec st_atim;		/* Time of last access.  */
6ca6e8
     struct timespec st_mtim;		/* Time of last modification.  */
6ca6e8
     struct timespec st_ctim;		/* Time of last status change.  */
6ca6e8
-#  else
6ca6e8
+#else
6ca6e8
     __time_t st_atime;			/* Time of last access.  */
6ca6e8
     unsigned long int st_atimensec;	/* Nscecs of last access.  */
6ca6e8
     __time_t st_mtime;			/* Time of last modification.  */
6ca6e8
     unsigned long int st_mtimensec;	/* Nsecs of last modification.  */
6ca6e8
     __time_t st_ctime;			/* Time of last status change.  */
6ca6e8
     unsigned long int st_ctimensec;	/* Nsecs of last status change.  */
6ca6e8
-#  endif
6ca6e8
-    __ino64_t st_ino;			/* File serial number.		*/
6ca6e8
-# endif /* __USE_TIME_BITS64  */
6ca6e8
+#endif
6ca6e8
+    int __glibc_reserved[2];
6ca6e8
   };
6ca6e8
 #endif
6ca6e8
 
6ca6e8
@@ -135,5 +124,4 @@ struct stat64
6ca6e8
 /* Nanosecond resolution time values are supported.  */
6ca6e8
 #define _STATBUF_ST_NSEC
6ca6e8
 
6ca6e8
-
6ca6e8
 #endif /* _BITS_STRUCT_STAT_H  */
6ca6e8
diff --git a/sysdeps/unix/sysv/linux/generic/bits/struct_stat.h b/sysdeps/unix/sysv/linux/csky/bits/struct_stat.h
6ca6e8
similarity index 91%
6ca6e8
rename from sysdeps/unix/sysv/linux/generic/bits/struct_stat.h
6ca6e8
rename to sysdeps/unix/sysv/linux/csky/bits/struct_stat.h
6ca6e8
index 32ef511ae5728276..f0ee455748d3ee41 100644
6ca6e8
--- a/sysdeps/unix/sysv/linux/generic/bits/struct_stat.h
6ca6e8
+++ b/sysdeps/unix/sysv/linux/csky/bits/struct_stat.h
6ca6e8
@@ -1,5 +1,5 @@
6ca6e8
-/* Definition for struct stat.
6ca6e8
-   Copyright (C) 2020-2021 Free Software Foundation, Inc.
6ca6e8
+/* Definition for struct stat.  Linux/csky version.
6ca6e8
+   Copyright (C) 2020-2022 Free Software Foundation, Inc.
6ca6e8
    This file is part of the GNU C Library.
6ca6e8
 
6ca6e8
    The GNU C Library is free software; you can redistribute it and/or
6ca6e8
@@ -43,6 +43,9 @@
6ca6e8
 
6ca6e8
 struct stat
6ca6e8
   {
6ca6e8
+#ifdef __USE_TIME_BITS64
6ca6e8
+# include <bits/struct_stat_time64_helper.h>
6ca6e8
+#else
6ca6e8
     __dev_t st_dev;		/* Device.  */
6ca6e8
     __field64(__ino_t, __ino64_t, st_ino);  /* File serial number. */
6ca6e8
     __mode_t st_mode;		/* File mode.  */
6ca6e8
@@ -55,7 +58,7 @@ struct stat
6ca6e8
     __blksize_t st_blksize;	/* Optimal block size for I/O.  */
6ca6e8
     int __pad2;
6ca6e8
     __field64(__blkcnt_t, __blkcnt64_t, st_blocks);  /* 512-byte blocks */
6ca6e8
-#ifdef __USE_XOPEN2K8
6ca6e8
+# ifdef __USE_XOPEN2K8
6ca6e8
     /* Nanosecond resolution timestamps are stored in a format
6ca6e8
        equivalent to 'struct timespec'.  This is the type used
6ca6e8
        whenever possible but the Unix namespace rules do not allow the
6ca6e8
@@ -65,18 +68,19 @@ struct stat
6ca6e8
     struct timespec st_atim;		/* Time of last access.  */
6ca6e8
     struct timespec st_mtim;		/* Time of last modification.  */
6ca6e8
     struct timespec st_ctim;		/* Time of last status change.  */
6ca6e8
-# define st_atime st_atim.tv_sec	/* Backward compatibility.  */
6ca6e8
-# define st_mtime st_mtim.tv_sec
6ca6e8
-# define st_ctime st_ctim.tv_sec
6ca6e8
-#else
6ca6e8
+#  define st_atime st_atim.tv_sec	/* Backward compatibility.  */
6ca6e8
+#  define st_mtime st_mtim.tv_sec
6ca6e8
+#  define st_ctime st_ctim.tv_sec
6ca6e8
+# else
6ca6e8
     __time_t st_atime;			/* Time of last access.  */
6ca6e8
     unsigned long int st_atimensec;	/* Nscecs of last access.  */
6ca6e8
     __time_t st_mtime;			/* Time of last modification.  */
6ca6e8
     unsigned long int st_mtimensec;	/* Nsecs of last modification.  */
6ca6e8
     __time_t st_ctime;			/* Time of last status change.  */
6ca6e8
     unsigned long int st_ctimensec;	/* Nsecs of last status change.  */
6ca6e8
-#endif
6ca6e8
+# endif
6ca6e8
     int __glibc_reserved[2];
6ca6e8
+#endif
6ca6e8
   };
6ca6e8
 
6ca6e8
 #undef __field64
6ca6e8
@@ -84,6 +88,9 @@ struct stat
6ca6e8
 #ifdef __USE_LARGEFILE64
6ca6e8
 struct stat64
6ca6e8
   {
6ca6e8
+# ifdef __USE_TIME_BITS64
6ca6e8
+#  include <bits/struct_stat_time64_helper.h>
6ca6e8
+# else
6ca6e8
     __dev_t st_dev;		/* Device.  */
6ca6e8
     __ino64_t st_ino;		/* File serial number.	*/
6ca6e8
     __mode_t st_mode;		/* File mode.  */
6ca6e8
@@ -96,7 +103,7 @@ struct stat64
6ca6e8
     __blksize_t st_blksize;	/* Optimal block size for I/O.  */
6ca6e8
     int __pad2;
6ca6e8
     __blkcnt64_t st_blocks;	/* Nr. 512-byte blocks allocated.  */
6ca6e8
-#ifdef __USE_XOPEN2K8
6ca6e8
+#  ifdef __USE_XOPEN2K8
6ca6e8
     /* Nanosecond resolution timestamps are stored in a format
6ca6e8
        equivalent to 'struct timespec'.  This is the type used
6ca6e8
        whenever possible but the Unix namespace rules do not allow the
6ca6e8
@@ -106,15 +113,16 @@ struct stat64
6ca6e8
     struct timespec st_atim;		/* Time of last access.  */
6ca6e8
     struct timespec st_mtim;		/* Time of last modification.  */
6ca6e8
     struct timespec st_ctim;		/* Time of last status change.  */
6ca6e8
-#else
6ca6e8
+#  else
6ca6e8
     __time_t st_atime;			/* Time of last access.  */
6ca6e8
     unsigned long int st_atimensec;	/* Nscecs of last access.  */
6ca6e8
     __time_t st_mtime;			/* Time of last modification.  */
6ca6e8
     unsigned long int st_mtimensec;	/* Nsecs of last modification.  */
6ca6e8
     __time_t st_ctime;			/* Time of last status change.  */
6ca6e8
     unsigned long int st_ctimensec;	/* Nsecs of last status change.  */
6ca6e8
-#endif
6ca6e8
+#  endif
6ca6e8
     int __glibc_reserved[2];
6ca6e8
+# endif
6ca6e8
   };
6ca6e8
 #endif
6ca6e8
 
6ca6e8
diff --git a/sysdeps/unix/sysv/linux/hppa/bits/struct_stat.h b/sysdeps/unix/sysv/linux/hppa/bits/struct_stat.h
6ca6e8
new file mode 100644
6ca6e8
index 0000000000000000..38b6e13e68890c29
6ca6e8
--- /dev/null
6ca6e8
+++ b/sysdeps/unix/sysv/linux/hppa/bits/struct_stat.h
6ca6e8
@@ -0,0 +1,139 @@
6ca6e8
+/* Definition for struct stat.  Linux/hppa version.
6ca6e8
+   Copyright (C) 2020-2022 Free Software Foundation, Inc.
6ca6e8
+   This file is part of the GNU C Library.
6ca6e8
+
6ca6e8
+   The GNU C Library is free software; you can redistribute it and/or
6ca6e8
+   modify it under the terms of the GNU Lesser General Public
6ca6e8
+   License as published by the Free Software Foundation; either
6ca6e8
+   version 2.1 of the License, or (at your option) any later version.
6ca6e8
+
6ca6e8
+   The GNU C Library is distributed in the hope that it will be useful,
6ca6e8
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
6ca6e8
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
6ca6e8
+   Lesser General Public License for more details.
6ca6e8
+
6ca6e8
+   You should have received a copy of the GNU Lesser General Public
6ca6e8
+   License along with the GNU C Library.  If not, see
6ca6e8
+   <https://www.gnu.org/licenses/>.  */
6ca6e8
+
6ca6e8
+#if !defined _SYS_STAT_H && !defined _FCNTL_H
6ca6e8
+# error "Never include <bits/struct_stat.h> directly; use <sys/stat.h> instead."
6ca6e8
+#endif
6ca6e8
+
6ca6e8
+#ifndef _BITS_STRUCT_STAT_H
6ca6e8
+#define _BITS_STRUCT_STAT_H	1
6ca6e8
+
6ca6e8
+#include <bits/endian.h>
6ca6e8
+#include <bits/wordsize.h>
6ca6e8
+
6ca6e8
+struct stat
6ca6e8
+  {
6ca6e8
+#ifdef __USE_TIME_BITS64
6ca6e8
+# include <bits/struct_stat_time64_helper.h>
6ca6e8
+#else
6ca6e8
+    __dev_t st_dev;			/* Device.  */
6ca6e8
+    unsigned short int __pad1;
6ca6e8
+# ifndef __USE_FILE_OFFSET64
6ca6e8
+    __ino_t st_ino;			/* File serial number.	*/
6ca6e8
+# else
6ca6e8
+    __ino_t __st_ino;			/* 32bit file serial number.	*/
6ca6e8
+# endif
6ca6e8
+    __mode_t st_mode;			/* File mode.  */
6ca6e8
+    __nlink_t st_nlink;			/* Link count.  */
6ca6e8
+    __uid_t st_uid;			/* User ID of the file's owner.	*/
6ca6e8
+    __gid_t st_gid;			/* Group ID of the file's group.*/
6ca6e8
+    __dev_t st_rdev;			/* Device number, if device.  */
6ca6e8
+    unsigned short int __pad2;
6ca6e8
+# ifndef __USE_FILE_OFFSET64
6ca6e8
+    __off_t st_size;			/* Size of file, in bytes.  */
6ca6e8
+# else
6ca6e8
+    __off64_t st_size;			/* Size of file, in bytes.  */
6ca6e8
+# endif
6ca6e8
+    __blksize_t st_blksize;		/* Optimal block size for I/O.  */
6ca6e8
+
6ca6e8
+# ifndef __USE_FILE_OFFSET64
6ca6e8
+    __blkcnt_t st_blocks;		/* Number 512-byte blocks allocated. */
6ca6e8
+# else
6ca6e8
+    __blkcnt64_t st_blocks;		/* Number 512-byte blocks allocated. */
6ca6e8
+# endif
6ca6e8
+# ifdef __USE_XOPEN2K8
6ca6e8
+    /* Nanosecond resolution timestamps are stored in a format
6ca6e8
+       equivalent to 'struct timespec'.  This is the type used
6ca6e8
+       whenever possible but the Unix namespace rules do not allow the
6ca6e8
+       identifier 'timespec' to appear in the <sys/stat.h> header.
6ca6e8
+       Therefore we have to handle the use of this header in strictly
6ca6e8
+       standard-compliant sources special.  */
6ca6e8
+    struct timespec st_atim;		/* Time of last access.  */
6ca6e8
+    struct timespec st_mtim;		/* Time of last modification.  */
6ca6e8
+    struct timespec st_ctim;		/* Time of last status change.  */
6ca6e8
+#  define st_atime st_atim.tv_sec	/* Backward compatibility.  */
6ca6e8
+#  define st_mtime st_mtim.tv_sec
6ca6e8
+#  define st_ctime st_ctim.tv_sec
6ca6e8
+# else
6ca6e8
+    __time_t st_atime;			/* Time of last access.  */
6ca6e8
+    unsigned long int st_atimensec;	/* Nscecs of last access.  */
6ca6e8
+    __time_t st_mtime;			/* Time of last modification.  */
6ca6e8
+    unsigned long int st_mtimensec;	/* Nsecs of last modification.  */
6ca6e8
+    __time_t st_ctime;			/* Time of last status change.  */
6ca6e8
+    unsigned long int st_ctimensec;	/* Nsecs of last status change.  */
6ca6e8
+# endif
6ca6e8
+# ifndef __USE_FILE_OFFSET64
6ca6e8
+    unsigned long int __glibc_reserved4;
6ca6e8
+    unsigned long int __glibc_reserved5;
6ca6e8
+# else
6ca6e8
+    __ino64_t st_ino;			/* File serial number.	*/
6ca6e8
+# endif
6ca6e8
+#endif /* __USE_TIME_BITS64  */
6ca6e8
+  };
6ca6e8
+
6ca6e8
+#ifdef __USE_LARGEFILE64
6ca6e8
+struct stat64
6ca6e8
+  {
6ca6e8
+# ifdef __USE_TIME_BITS64
6ca6e8
+#  include <bits/struct_stat_time64_helper.h>
6ca6e8
+# else
6ca6e8
+    __dev_t st_dev;			/* Device.  */
6ca6e8
+    unsigned int __pad1;
6ca6e8
+
6ca6e8
+    __ino_t __st_ino;			/* 32bit file serial number.	*/
6ca6e8
+    __mode_t st_mode;			/* File mode.  */
6ca6e8
+    __nlink_t st_nlink;			/* Link count.  */
6ca6e8
+    __uid_t st_uid;			/* User ID of the file's owner.	*/
6ca6e8
+    __gid_t st_gid;			/* Group ID of the file's group.*/
6ca6e8
+    __dev_t st_rdev;			/* Device number, if device.  */
6ca6e8
+    unsigned int __pad2;
6ca6e8
+    __off64_t st_size;			/* Size of file, in bytes.  */
6ca6e8
+    __blksize_t st_blksize;		/* Optimal block size for I/O.  */
6ca6e8
+
6ca6e8
+    __blkcnt64_t st_blocks;		/* Number 512-byte blocks allocated. */
6ca6e8
+#  ifdef __USE_XOPEN2K8
6ca6e8
+    /* Nanosecond resolution timestamps are stored in a format
6ca6e8
+       equivalent to 'struct timespec'.  This is the type used
6ca6e8
+       whenever possible but the Unix namespace rules do not allow the
6ca6e8
+       identifier 'timespec' to appear in the <sys/stat.h> header.
6ca6e8
+       Therefore we have to handle the use of this header in strictly
6ca6e8
+       standard-compliant sources special.  */
6ca6e8
+    struct timespec st_atim;		/* Time of last access.  */
6ca6e8
+    struct timespec st_mtim;		/* Time of last modification.  */
6ca6e8
+    struct timespec st_ctim;		/* Time of last status change.  */
6ca6e8
+#  else
6ca6e8
+    __time_t st_atime;			/* Time of last access.  */
6ca6e8
+    unsigned long int st_atimensec;	/* Nscecs of last access.  */
6ca6e8
+    __time_t st_mtime;			/* Time of last modification.  */
6ca6e8
+    unsigned long int st_mtimensec;	/* Nsecs of last modification.  */
6ca6e8
+    __time_t st_ctime;			/* Time of last status change.  */
6ca6e8
+    unsigned long int st_ctimensec;	/* Nsecs of last status change.  */
6ca6e8
+#  endif
6ca6e8
+    __ino64_t st_ino;			/* File serial number.		*/
6ca6e8
+# endif /* __USE_TIME_BITS64  */
6ca6e8
+  };
6ca6e8
+#endif
6ca6e8
+
6ca6e8
+/* Tell code we have these members.  */
6ca6e8
+#define	_STATBUF_ST_BLKSIZE
6ca6e8
+#define _STATBUF_ST_RDEV
6ca6e8
+/* Nanosecond resolution time values are supported.  */
6ca6e8
+#define _STATBUF_ST_NSEC
6ca6e8
+
6ca6e8
+
6ca6e8
+#endif /* _BITS_STRUCT_STAT_H  */
6ca6e8
diff --git a/sysdeps/unix/sysv/linux/nios2/bits/struct_stat.h b/sysdeps/unix/sysv/linux/nios2/bits/struct_stat.h
6ca6e8
new file mode 100644
6ca6e8
index 0000000000000000..e00e71173e184b48
6ca6e8
--- /dev/null
6ca6e8
+++ b/sysdeps/unix/sysv/linux/nios2/bits/struct_stat.h
6ca6e8
@@ -0,0 +1,135 @@
6ca6e8
+/* Definition for struct stat.  Linux/nios2 version.
6ca6e8
+   Copyright (C) 2020-2022 Free Software Foundation, Inc.
6ca6e8
+   This file is part of the GNU C Library.
6ca6e8
+
6ca6e8
+   The GNU C Library is free software; you can redistribute it and/or
6ca6e8
+   modify it under the terms of the GNU Lesser General Public
6ca6e8
+   License as published by the Free Software Foundation; either
6ca6e8
+   version 2.1 of the License, or (at your option) any later version.
6ca6e8
+
6ca6e8
+   The GNU C Library is distributed in the hope that it will be useful,
6ca6e8
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
6ca6e8
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
6ca6e8
+   Lesser General Public License for more details.
6ca6e8
+
6ca6e8
+   You should have received a copy of the GNU Lesser General Public
6ca6e8
+   License along with the GNU C Library.  If not, see
6ca6e8
+   <https://www.gnu.org/licenses/>.  */
6ca6e8
+
6ca6e8
+#if !defined _SYS_STAT_H && !defined _FCNTL_H
6ca6e8
+# error "Never include <bits/struct_stat.h> directly; use <sys/stat.h> instead."
6ca6e8
+#endif
6ca6e8
+
6ca6e8
+#ifndef _BITS_STRUCT_STAT_H
6ca6e8
+#define _BITS_STRUCT_STAT_H	1
6ca6e8
+
6ca6e8
+#include <bits/endian.h>
6ca6e8
+#include <bits/wordsize.h>
6ca6e8
+
6ca6e8
+#if defined __USE_FILE_OFFSET64
6ca6e8
+# define __field64(type, type64, name) type64 name
6ca6e8
+#elif __WORDSIZE == 64 || defined __INO_T_MATCHES_INO64_T
6ca6e8
+# if defined __INO_T_MATCHES_INO64_T && !defined __OFF_T_MATCHES_OFF64_T
6ca6e8
+#  error "ino_t and off_t must both be the same type"
6ca6e8
+# endif
6ca6e8
+# define __field64(type, type64, name) type name
6ca6e8
+#elif __BYTE_ORDER == __LITTLE_ENDIAN
6ca6e8
+# define __field64(type, type64, name) \
6ca6e8
+  type name __attribute__((__aligned__ (__alignof__ (type64)))); int __##name##_pad
6ca6e8
+#else
6ca6e8
+# define __field64(type, type64, name) \
6ca6e8
+  int __##name##_pad __attribute__((__aligned__ (__alignof__ (type64)))); type name
6ca6e8
+#endif
6ca6e8
+
6ca6e8
+struct stat
6ca6e8
+  {
6ca6e8
+#ifdef __USE_TIME_BITS64
6ca6e8
+# include <bits/struct_stat_time64_helper.h>
6ca6e8
+#else
6ca6e8
+    __dev_t st_dev;		/* Device.  */
6ca6e8
+    __field64(__ino_t, __ino64_t, st_ino);  /* File serial number. */
6ca6e8
+    __mode_t st_mode;		/* File mode.  */
6ca6e8
+    __nlink_t st_nlink;		/* Link count.  */
6ca6e8
+    __uid_t st_uid;		/* User ID of the file's owner.	*/
6ca6e8
+    __gid_t st_gid;		/* Group ID of the file's group.*/
6ca6e8
+    __dev_t st_rdev;		/* Device number, if device.  */
6ca6e8
+    __dev_t __pad1;
6ca6e8
+    __field64(__off_t, __off64_t, st_size);  /* Size of file, in bytes. */
6ca6e8
+    __blksize_t st_blksize;	/* Optimal block size for I/O.  */
6ca6e8
+    int __pad2;
6ca6e8
+    __field64(__blkcnt_t, __blkcnt64_t, st_blocks);  /* 512-byte blocks */
6ca6e8
+# ifdef __USE_XOPEN2K8
6ca6e8
+    /* Nanosecond resolution timestamps are stored in a format
6ca6e8
+       equivalent to 'struct timespec'.  This is the type used
6ca6e8
+       whenever possible but the Unix namespace rules do not allow the
6ca6e8
+       identifier 'timespec' to appear in the <sys/stat.h> header.
6ca6e8
+       Therefore we have to handle the use of this header in strictly
6ca6e8
+       standard-compliant sources special.  */
6ca6e8
+    struct timespec st_atim;		/* Time of last access.  */
6ca6e8
+    struct timespec st_mtim;		/* Time of last modification.  */
6ca6e8
+    struct timespec st_ctim;		/* Time of last status change.  */
6ca6e8
+#  define st_atime st_atim.tv_sec	/* Backward compatibility.  */
6ca6e8
+#  define st_mtime st_mtim.tv_sec
6ca6e8
+#  define st_ctime st_ctim.tv_sec
6ca6e8
+# else
6ca6e8
+    __time_t st_atime;			/* Time of last access.  */
6ca6e8
+    unsigned long int st_atimensec;	/* Nscecs of last access.  */
6ca6e8
+    __time_t st_mtime;			/* Time of last modification.  */
6ca6e8
+    unsigned long int st_mtimensec;	/* Nsecs of last modification.  */
6ca6e8
+    __time_t st_ctime;			/* Time of last status change.  */
6ca6e8
+    unsigned long int st_ctimensec;	/* Nsecs of last status change.  */
6ca6e8
+# endif
6ca6e8
+    int __glibc_reserved[2];
6ca6e8
+#endif
6ca6e8
+  };
6ca6e8
+
6ca6e8
+#undef __field64
6ca6e8
+
6ca6e8
+#ifdef __USE_LARGEFILE64
6ca6e8
+struct stat64
6ca6e8
+  {
6ca6e8
+# ifdef __USE_TIME_BITS64
6ca6e8
+#  include <bits/struct_stat_time64_helper.h>
6ca6e8
+# else
6ca6e8
+    __dev_t st_dev;		/* Device.  */
6ca6e8
+    __ino64_t st_ino;		/* File serial number.	*/
6ca6e8
+    __mode_t st_mode;		/* File mode.  */
6ca6e8
+    __nlink_t st_nlink;		/* Link count.  */
6ca6e8
+    __uid_t st_uid;		/* User ID of the file's owner.	*/
6ca6e8
+    __gid_t st_gid;		/* Group ID of the file's group.*/
6ca6e8
+    __dev_t st_rdev;		/* Device number, if device.  */
6ca6e8
+    __dev_t __pad1;
6ca6e8
+    __off64_t st_size;		/* Size of file, in bytes.  */
6ca6e8
+    __blksize_t st_blksize;	/* Optimal block size for I/O.  */
6ca6e8
+    int __pad2;
6ca6e8
+    __blkcnt64_t st_blocks;	/* Nr. 512-byte blocks allocated.  */
6ca6e8
+#  ifdef __USE_XOPEN2K8
6ca6e8
+    /* Nanosecond resolution timestamps are stored in a format
6ca6e8
+       equivalent to 'struct timespec'.  This is the type used
6ca6e8
+       whenever possible but the Unix namespace rules do not allow the
6ca6e8
+       identifier 'timespec' to appear in the <sys/stat.h> header.
6ca6e8
+       Therefore we have to handle the use of this header in strictly
6ca6e8
+       standard-compliant sources special.  */
6ca6e8
+    struct timespec st_atim;		/* Time of last access.  */
6ca6e8
+    struct timespec st_mtim;		/* Time of last modification.  */
6ca6e8
+    struct timespec st_ctim;		/* Time of last status change.  */
6ca6e8
+#  else
6ca6e8
+    __time_t st_atime;			/* Time of last access.  */
6ca6e8
+    unsigned long int st_atimensec;	/* Nscecs of last access.  */
6ca6e8
+    __time_t st_mtime;			/* Time of last modification.  */
6ca6e8
+    unsigned long int st_mtimensec;	/* Nsecs of last modification.  */
6ca6e8
+    __time_t st_ctime;			/* Time of last status change.  */
6ca6e8
+    unsigned long int st_ctimensec;	/* Nsecs of last status change.  */
6ca6e8
+#  endif
6ca6e8
+    int __glibc_reserved[2];
6ca6e8
+# endif
6ca6e8
+  };
6ca6e8
+#endif
6ca6e8
+
6ca6e8
+/* Tell code we have these members.  */
6ca6e8
+#define	_STATBUF_ST_BLKSIZE
6ca6e8
+#define _STATBUF_ST_RDEV
6ca6e8
+/* Nanosecond resolution time values are supported.  */
6ca6e8
+#define _STATBUF_ST_NSEC
6ca6e8
+
6ca6e8
+#endif /* _BITS_STRUCT_STAT_H  */
6ca6e8
diff --git a/sysdeps/unix/sysv/linux/sh/bits/struct_stat.h b/sysdeps/unix/sysv/linux/sh/bits/struct_stat.h
6ca6e8
new file mode 100644
6ca6e8
index 0000000000000000..0f7c9cdc89ebf686
6ca6e8
--- /dev/null
6ca6e8
+++ b/sysdeps/unix/sysv/linux/sh/bits/struct_stat.h
6ca6e8
@@ -0,0 +1,139 @@
6ca6e8
+/* Definition for struct stat.  Linux/sh version.
6ca6e8
+   Copyright (C) 2020-2022 Free Software Foundation, Inc.
6ca6e8
+   This file is part of the GNU C Library.
6ca6e8
+
6ca6e8
+   The GNU C Library is free software; you can redistribute it and/or
6ca6e8
+   modify it under the terms of the GNU Lesser General Public
6ca6e8
+   License as published by the Free Software Foundation; either
6ca6e8
+   version 2.1 of the License, or (at your option) any later version.
6ca6e8
+
6ca6e8
+   The GNU C Library is distributed in the hope that it will be useful,
6ca6e8
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
6ca6e8
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
6ca6e8
+   Lesser General Public License for more details.
6ca6e8
+
6ca6e8
+   You should have received a copy of the GNU Lesser General Public
6ca6e8
+   License along with the GNU C Library.  If not, see
6ca6e8
+   <https://www.gnu.org/licenses/>.  */
6ca6e8
+
6ca6e8
+#if !defined _SYS_STAT_H && !defined _FCNTL_H
6ca6e8
+# error "Never include <bits/struct_stat.h> directly; use <sys/stat.h> instead."
6ca6e8
+#endif
6ca6e8
+
6ca6e8
+#ifndef _BITS_STRUCT_STAT_H
6ca6e8
+#define _BITS_STRUCT_STAT_H	1
6ca6e8
+
6ca6e8
+#include <bits/endian.h>
6ca6e8
+#include <bits/wordsize.h>
6ca6e8
+
6ca6e8
+struct stat
6ca6e8
+  {
6ca6e8
+#ifdef __USE_TIME_BITS64
6ca6e8
+# include <bits/struct_stat_time64_helper.h>
6ca6e8
+#else
6ca6e8
+    __dev_t st_dev;			/* Device.  */
6ca6e8
+    unsigned short int __pad1;
6ca6e8
+# ifndef __USE_FILE_OFFSET64
6ca6e8
+    __ino_t st_ino;			/* File serial number.	*/
6ca6e8
+# else
6ca6e8
+    __ino_t __st_ino;			/* 32bit file serial number.	*/
6ca6e8
+# endif
6ca6e8
+    __mode_t st_mode;			/* File mode.  */
6ca6e8
+    __nlink_t st_nlink;			/* Link count.  */
6ca6e8
+    __uid_t st_uid;			/* User ID of the file's owner.	*/
6ca6e8
+    __gid_t st_gid;			/* Group ID of the file's group.*/
6ca6e8
+    __dev_t st_rdev;			/* Device number, if device.  */
6ca6e8
+    unsigned short int __pad2;
6ca6e8
+# ifndef __USE_FILE_OFFSET64
6ca6e8
+    __off_t st_size;			/* Size of file, in bytes.  */
6ca6e8
+# else
6ca6e8
+    __off64_t st_size;			/* Size of file, in bytes.  */
6ca6e8
+# endif
6ca6e8
+    __blksize_t st_blksize;		/* Optimal block size for I/O.  */
6ca6e8
+
6ca6e8
+# ifndef __USE_FILE_OFFSET64
6ca6e8
+    __blkcnt_t st_blocks;		/* Number 512-byte blocks allocated. */
6ca6e8
+# else
6ca6e8
+    __blkcnt64_t st_blocks;		/* Number 512-byte blocks allocated. */
6ca6e8
+# endif
6ca6e8
+# ifdef __USE_XOPEN2K8
6ca6e8
+    /* Nanosecond resolution timestamps are stored in a format
6ca6e8
+       equivalent to 'struct timespec'.  This is the type used
6ca6e8
+       whenever possible but the Unix namespace rules do not allow the
6ca6e8
+       identifier 'timespec' to appear in the <sys/stat.h> header.
6ca6e8
+       Therefore we have to handle the use of this header in strictly
6ca6e8
+       standard-compliant sources special.  */
6ca6e8
+    struct timespec st_atim;		/* Time of last access.  */
6ca6e8
+    struct timespec st_mtim;		/* Time of last modification.  */
6ca6e8
+    struct timespec st_ctim;		/* Time of last status change.  */
6ca6e8
+#  define st_atime st_atim.tv_sec	/* Backward compatibility.  */
6ca6e8
+#  define st_mtime st_mtim.tv_sec
6ca6e8
+#  define st_ctime st_ctim.tv_sec
6ca6e8
+# else
6ca6e8
+    __time_t st_atime;			/* Time of last access.  */
6ca6e8
+    unsigned long int st_atimensec;	/* Nscecs of last access.  */
6ca6e8
+    __time_t st_mtime;			/* Time of last modification.  */
6ca6e8
+    unsigned long int st_mtimensec;	/* Nsecs of last modification.  */
6ca6e8
+    __time_t st_ctime;			/* Time of last status change.  */
6ca6e8
+    unsigned long int st_ctimensec;	/* Nsecs of last status change.  */
6ca6e8
+# endif
6ca6e8
+# ifndef __USE_FILE_OFFSET64
6ca6e8
+    unsigned long int __glibc_reserved4;
6ca6e8
+    unsigned long int __glibc_reserved5;
6ca6e8
+# else
6ca6e8
+    __ino64_t st_ino;			/* File serial number.	*/
6ca6e8
+# endif
6ca6e8
+#endif /* __USE_TIME_BITS64  */
6ca6e8
+  };
6ca6e8
+
6ca6e8
+#ifdef __USE_LARGEFILE64
6ca6e8
+struct stat64
6ca6e8
+  {
6ca6e8
+# ifdef __USE_TIME_BITS64
6ca6e8
+#  include <bits/struct_stat_time64_helper.h>
6ca6e8
+# else
6ca6e8
+    __dev_t st_dev;			/* Device.  */
6ca6e8
+    unsigned int __pad1;
6ca6e8
+
6ca6e8
+    __ino_t __st_ino;			/* 32bit file serial number.	*/
6ca6e8
+    __mode_t st_mode;			/* File mode.  */
6ca6e8
+    __nlink_t st_nlink;			/* Link count.  */
6ca6e8
+    __uid_t st_uid;			/* User ID of the file's owner.	*/
6ca6e8
+    __gid_t st_gid;			/* Group ID of the file's group.*/
6ca6e8
+    __dev_t st_rdev;			/* Device number, if device.  */
6ca6e8
+    unsigned int __pad2;
6ca6e8
+    __off64_t st_size;			/* Size of file, in bytes.  */
6ca6e8
+    __blksize_t st_blksize;		/* Optimal block size for I/O.  */
6ca6e8
+
6ca6e8
+    __blkcnt64_t st_blocks;		/* Number 512-byte blocks allocated. */
6ca6e8
+#  ifdef __USE_XOPEN2K8
6ca6e8
+    /* Nanosecond resolution timestamps are stored in a format
6ca6e8
+       equivalent to 'struct timespec'.  This is the type used
6ca6e8
+       whenever possible but the Unix namespace rules do not allow the
6ca6e8
+       identifier 'timespec' to appear in the <sys/stat.h> header.
6ca6e8
+       Therefore we have to handle the use of this header in strictly
6ca6e8
+       standard-compliant sources special.  */
6ca6e8
+    struct timespec st_atim;		/* Time of last access.  */
6ca6e8
+    struct timespec st_mtim;		/* Time of last modification.  */
6ca6e8
+    struct timespec st_ctim;		/* Time of last status change.  */
6ca6e8
+#  else
6ca6e8
+    __time_t st_atime;			/* Time of last access.  */
6ca6e8
+    unsigned long int st_atimensec;	/* Nscecs of last access.  */
6ca6e8
+    __time_t st_mtime;			/* Time of last modification.  */
6ca6e8
+    unsigned long int st_mtimensec;	/* Nsecs of last modification.  */
6ca6e8
+    __time_t st_ctime;			/* Time of last status change.  */
6ca6e8
+    unsigned long int st_ctimensec;	/* Nsecs of last status change.  */
6ca6e8
+#  endif
6ca6e8
+    __ino64_t st_ino;			/* File serial number.		*/
6ca6e8
+# endif /* __USE_TIME_BITS64  */
6ca6e8
+  };
6ca6e8
+#endif
6ca6e8
+
6ca6e8
+/* Tell code we have these members.  */
6ca6e8
+#define	_STATBUF_ST_BLKSIZE
6ca6e8
+#define _STATBUF_ST_RDEV
6ca6e8
+/* Nanosecond resolution time values are supported.  */
6ca6e8
+#define _STATBUF_ST_NSEC
6ca6e8
+
6ca6e8
+
6ca6e8
+#endif /* _BITS_STRUCT_STAT_H  */