Browse Source

enable nanosecond stat support for everyone

Fill out the stat structure so that the nanosecond resolution support is
always available.  There is a small code size increase for a few ports
(three additional assignments in xstatconv), but otherwise everything
should remain the same.

While we're here, punt __old_kernel_stat from the few headers that still
define it as it is unused in uClibc and causes compile errors after these
nanosecond changes.

Signed-off-by: Mike Frysinger <vapier@gentoo.org>
Mike Frysinger 15 years ago
parent
commit
8bf1bb4bf1
35 changed files with 292 additions and 409 deletions
  1. 3 6
      libc/sysdeps/linux/alpha/bits/kernel_stat.h
  2. 1 1
      libc/sysdeps/linux/alpha/bits/stat.h
  3. 6 14
      libc/sysdeps/linux/arm/bits/kernel_stat.h
  4. 6 16
      libc/sysdeps/linux/avr32/bits/kernel_stat.h
  5. 6 12
      libc/sysdeps/linux/bfin/bits/kernel_stat.h
  6. 2 2
      libc/sysdeps/linux/common/bits/stat.h
  7. 6 16
      libc/sysdeps/linux/common/xstatconv.c
  8. 6 28
      libc/sysdeps/linux/cris/bits/kernel_stat.h
  9. 6 12
      libc/sysdeps/linux/e1/bits/kernel_stat.h
  10. 6 16
      libc/sysdeps/linux/frv/bits/kernel_stat.h
  11. 6 12
      libc/sysdeps/linux/h8300/bits/kernel_stat.h
  12. 6 14
      libc/sysdeps/linux/hppa/bits/kernel_stat.h
  13. 6 12
      libc/sysdeps/linux/i386/bits/kernel_stat.h
  14. 3 27
      libc/sysdeps/linux/ia64/bits/kernel_stat.h
  15. 2 2
      libc/sysdeps/linux/ia64/bits/stat.h
  16. 6 12
      libc/sysdeps/linux/m68k/bits/kernel_stat.h
  17. 2 2
      libc/sysdeps/linux/m68k/bits/stat.h
  18. 6 14
      libc/sysdeps/linux/microblaze/bits/kernel_stat.h
  19. 12 26
      libc/sysdeps/linux/mips/bits/kernel_stat.h
  20. 62 16
      libc/sysdeps/linux/mips/bits/stat.h
  21. 35 6
      libc/sysdeps/linux/nios/bits/stat.h
  22. 6 12
      libc/sysdeps/linux/nios2/bits/kernel_stat.h
  23. 35 6
      libc/sysdeps/linux/nios2/bits/stat.h
  24. 7 12
      libc/sysdeps/linux/powerpc/bits/kernel_stat.h
  25. 4 4
      libc/sysdeps/linux/powerpc/bits/stat.h
  26. 6 14
      libc/sysdeps/linux/sh/bits/kernel_stat.h
  27. 6 14
      libc/sysdeps/linux/sh64/bits/kernel_stat.h
  28. 7 12
      libc/sysdeps/linux/sparc/bits/kernel_stat.h
  29. 2 2
      libc/sysdeps/linux/sparc/bits/stat.h
  30. 6 14
      libc/sysdeps/linux/v850/bits/kernel_stat.h
  31. 6 12
      libc/sysdeps/linux/vax/bits/kernel_stat.h
  32. 3 23
      libc/sysdeps/linux/x86_64/bits/kernel_stat.h
  33. 2 2
      libc/sysdeps/linux/x86_64/bits/stat.h
  34. 6 14
      libc/sysdeps/linux/xtensa/bits/kernel_stat.h
  35. 2 2
      libc/sysdeps/linux/xtensa/bits/stat.h

+ 3 - 6
libc/sysdeps/linux/alpha/bits/kernel_stat.h

@@ -40,12 +40,9 @@ struct kernel_stat64 {
 	unsigned int	st_nlink;
 	unsigned int	st_nlink;
 	unsigned int	__pad0;
 	unsigned int	__pad0;
 
 
-	unsigned long	st_atime;
+	struct timespec	st_atim;
-	unsigned long	st_atimensec;
+	struct timespec	st_mtim;
-	unsigned long	st_mtime;
+	struct timespec	st_ctim;
-	unsigned long	st_mtimensec;
-	unsigned long	st_ctime;
-	unsigned long	st_ctimensec;
 	long		__unused[3];
 	long		__unused[3];
 };
 };
 
 

+ 1 - 1
libc/sysdeps/linux/alpha/bits/stat.h

@@ -41,7 +41,7 @@
 
 
    Use neat tidy anonymous unions and structures when possible.  */
    Use neat tidy anonymous unions and structures when possible.  */
 
 
-#if 0 /*def __USE_MISC*/
+#ifdef __USE_MISC
 # if __GNUC_PREREQ(3,3)
 # if __GNUC_PREREQ(3,3)
 #  define __ST_TIME(X)				\
 #  define __ST_TIME(X)				\
 	__extension__ union {			\
 	__extension__ union {			\

+ 6 - 14
libc/sysdeps/linux/arm/bits/kernel_stat.h

@@ -9,8 +9,6 @@
  * struct kernel_stat should look like...  It turns out each arch has a
  * struct kernel_stat should look like...  It turns out each arch has a
  * different opinion on the subject... */
  * different opinion on the subject... */
 
 
-#define STAT_HAVE_NSEC 1
-
 struct kernel_stat {
 struct kernel_stat {
 #if defined(__ARMEB__)
 #if defined(__ARMEB__)
 	unsigned short st_dev;
 	unsigned short st_dev;
@@ -32,12 +30,9 @@ struct kernel_stat {
 	unsigned long  st_size;
 	unsigned long  st_size;
 	unsigned long  st_blksize;
 	unsigned long  st_blksize;
 	unsigned long  st_blocks;
 	unsigned long  st_blocks;
-	unsigned long  st_atime;
+	struct timespec st_atim;
-	unsigned long  st_atime_nsec;
+	struct timespec st_mtim;
-	unsigned long  st_mtime;
+	struct timespec st_ctim;
-	unsigned long  st_mtime_nsec;
-	unsigned long  st_ctime;
-	unsigned long  st_ctime_nsec;
 	unsigned long  __unused4;
 	unsigned long  __unused4;
 	unsigned long  __unused5;
 	unsigned long  __unused5;
 };
 };
@@ -60,12 +55,9 @@ struct kernel_stat64 {
 	unsigned long      st_blksize;
 	unsigned long      st_blksize;
 	unsigned long long st_blocks;  /* Number 512-byte blocks allocated. */
 	unsigned long long st_blocks;  /* Number 512-byte blocks allocated. */
 
 
-	unsigned long      st_atime;
+	struct timespec    st_atim;
-	unsigned long      st_atime_nsec;
+	struct timespec    st_mtim;
-	unsigned long      st_mtime;
+	struct timespec    st_ctim;
-	unsigned long      st_mtime_nsec;
-	unsigned long      st_ctime;
-	unsigned long      st_ctime_nsec;
 	unsigned long long st_ino;
 	unsigned long long st_ino;
 #ifndef __ARM_EABI__
 #ifndef __ARM_EABI__
 } __attribute__((packed));
 } __attribute__((packed));

+ 6 - 16
libc/sysdeps/linux/avr32/bits/kernel_stat.h

@@ -21,18 +21,13 @@ struct kernel_stat {
         unsigned long		st_size;
         unsigned long		st_size;
         unsigned long		st_blksize;
         unsigned long		st_blksize;
         unsigned long		st_blocks;
         unsigned long		st_blocks;
-        unsigned long		st_atime;
+        struct timespec		st_atim;
-        unsigned long		st_atime_nsec;
+        struct timespec		st_mtim;
-        unsigned long		st_mtime;
+        struct timespec		st_ctim;
-        unsigned long		st_mtime_nsec;
-        unsigned long		st_ctime;
-        unsigned long		st_ctime_nsec;
         unsigned long		__unused4;
         unsigned long		__unused4;
         unsigned long		__unused5;
         unsigned long		__unused5;
 };
 };
 
 
-#define STAT_HAVE_NSEC 1
-
 struct kernel_stat64 {
 struct kernel_stat64 {
 	unsigned long long	st_dev;
 	unsigned long long	st_dev;
 
 
@@ -51,14 +46,9 @@ struct kernel_stat64 {
 
 
 	unsigned long long	st_blocks;
 	unsigned long long	st_blocks;
 
 
-	unsigned long		st_atime;
+	struct timespec		st_atim;
-	unsigned long		st_atime_nsec;
+	struct timespec		st_mtim;
-
+	struct timespec		st_ctim;
-	unsigned long		st_mtime;
-	unsigned long		st_mtime_nsec;
-
-	unsigned long		st_ctime;
-	unsigned long		st_ctime_nsec;
 
 
 	unsigned long		__unused1;
 	unsigned long		__unused1;
 	unsigned long		__unused2;
 	unsigned long		__unused2;

+ 6 - 12
libc/sysdeps/linux/bfin/bits/kernel_stat.h

@@ -22,12 +22,9 @@ struct kernel_stat {
 	unsigned long  st_size;
 	unsigned long  st_size;
 	unsigned long  st_blksize;
 	unsigned long  st_blksize;
 	unsigned long  st_blocks;
 	unsigned long  st_blocks;
-	unsigned long  st_atime;
+	struct timespec st_atim;
-	unsigned long  __unused1;
+	struct timespec st_mtim;
-	unsigned long  st_mtime;
+	struct timespec st_ctim;
-	unsigned long  __unused2;
-	unsigned long  st_ctime;
-	unsigned long  __unused3;
 	unsigned long  __unused4;
 	unsigned long  __unused4;
 	unsigned long  __unused5;
 	unsigned long  __unused5;
 };
 };
@@ -47,12 +44,9 @@ struct kernel_stat64 {
 	unsigned long	st_blksize;
 	unsigned long	st_blksize;
 	unsigned long	st_blocks;	/* Number 512-byte blocks allocated. */
 	unsigned long	st_blocks;	/* Number 512-byte blocks allocated. */
 	unsigned long	__pad4;		/* future possible st_blocks high bits */
 	unsigned long	__pad4;		/* future possible st_blocks high bits */
-	unsigned long	st_atime;
+	struct timespec	st_atim;
-	unsigned long	__pad5;
+	struct timespec	st_mtim;
-	unsigned long	st_mtime;
+	struct timespec	st_ctim;
-	unsigned long	__pad6;
-	unsigned long	st_ctime;
-	unsigned long	__pad7;		/* will be high 32 bits of ctime someday */
 	unsigned long long	st_ino;
 	unsigned long long	st_ino;
 };
 };
 
 

+ 2 - 2
libc/sysdeps/linux/common/bits/stat.h

@@ -62,7 +62,7 @@ struct stat
 #else
 #else
     __blkcnt64_t st_blocks;		/* Number 512-byte blocks allocated. */
     __blkcnt64_t st_blocks;		/* Number 512-byte blocks allocated. */
 #endif
 #endif
-#if 0 /*def __USE_MISC*/
+#ifdef __USE_MISC
     /* Nanosecond resolution timestamps are stored in a format
     /* Nanosecond resolution timestamps are stored in a format
        equivalent to 'struct timespec'.  This is the type used
        equivalent to 'struct timespec'.  This is the type used
        whenever possible but the Unix namespace rules do not allow the
        whenever possible but the Unix namespace rules do not allow the
@@ -108,7 +108,7 @@ struct stat64
     __blksize_t st_blksize;		/* Optimal block size for I/O.  */
     __blksize_t st_blksize;		/* Optimal block size for I/O.  */
 
 
     __blkcnt64_t st_blocks;		/* Number 512-byte blocks allocated. */
     __blkcnt64_t st_blocks;		/* Number 512-byte blocks allocated. */
-#if 0 /*def __USE_MISC*/
+#ifdef __USE_MISC
     /* Nanosecond resolution timestamps are stored in a format
     /* Nanosecond resolution timestamps are stored in a format
        equivalent to 'struct timespec'.  This is the type used
        equivalent to 'struct timespec'.  This is the type used
        whenever possible but the Unix namespace rules do not allow the
        whenever possible but the Unix namespace rules do not allow the

+ 6 - 16
libc/sysdeps/linux/common/xstatconv.c

@@ -41,14 +41,9 @@ void attribute_hidden __xstat_conv(struct kernel_stat *kbuf, struct stat *buf)
 	buf->st_size = kbuf->st_size;
 	buf->st_size = kbuf->st_size;
 	buf->st_blksize = kbuf->st_blksize;
 	buf->st_blksize = kbuf->st_blksize;
 	buf->st_blocks = kbuf->st_blocks;
 	buf->st_blocks = kbuf->st_blocks;
-	buf->st_atime = kbuf->st_atime;
+	buf->st_atim = kbuf->st_atim;
-	buf->st_mtime = kbuf->st_mtime;
+	buf->st_mtim = kbuf->st_mtim;
-	buf->st_ctime = kbuf->st_ctime;
+	buf->st_ctim = kbuf->st_ctim;
-#ifdef STAT_HAVE_NSEC
-	buf->st_atimensec = kbuf->st_atime_nsec;
-	buf->st_mtimensec = kbuf->st_mtime_nsec;
-	buf->st_ctimensec = kbuf->st_ctime_nsec;
-#endif
 }
 }
 
 
 #ifdef __UCLIBC_HAS_LFS__
 #ifdef __UCLIBC_HAS_LFS__
@@ -70,14 +65,9 @@ void attribute_hidden __xstat64_conv(struct kernel_stat64 *kbuf, struct stat64 *
 	buf->st_size = kbuf->st_size;
 	buf->st_size = kbuf->st_size;
 	buf->st_blksize = kbuf->st_blksize;
 	buf->st_blksize = kbuf->st_blksize;
 	buf->st_blocks = kbuf->st_blocks;
 	buf->st_blocks = kbuf->st_blocks;
-	buf->st_atime = kbuf->st_atime;
+	buf->st_atim = kbuf->st_atim;
-	buf->st_mtime = kbuf->st_mtime;
+	buf->st_mtim = kbuf->st_mtim;
-	buf->st_ctime = kbuf->st_ctime;
+	buf->st_ctim = kbuf->st_ctim;
-# ifdef STAT_HAVE_NSEC
-	buf->st_atimensec = kbuf->st_atime_nsec;
-	buf->st_mtimensec = kbuf->st_mtime_nsec;
-	buf->st_ctimensec = kbuf->st_ctime_nsec;
-# endif
 }
 }
 
 
 #endif /* __UCLIBC_HAS_LFS__ */
 #endif /* __UCLIBC_HAS_LFS__ */

+ 6 - 28
libc/sysdeps/linux/cris/bits/kernel_stat.h

@@ -7,20 +7,6 @@
 #error bits/kernel_stat.h is for internal uClibc use only!
 #error bits/kernel_stat.h is for internal uClibc use only!
 #endif
 #endif
 
 
-struct __old_kernel_stat {
-	unsigned short st_dev;
-	unsigned short st_ino;
-	unsigned short st_mode;
-	unsigned short st_nlink;
-	unsigned short st_uid;
-	unsigned short st_gid;
-	unsigned short st_rdev;
-	unsigned long  st_size;
-	unsigned long  st_atime;
-	unsigned long  st_mtime;
-	unsigned long  st_ctime;
-};
-
 struct kernel_stat {
 struct kernel_stat {
 	unsigned short st_dev;
 	unsigned short st_dev;
 	unsigned short __pad1;
 	unsigned short __pad1;
@@ -34,12 +20,9 @@ struct kernel_stat {
 	unsigned long  st_size;
 	unsigned long  st_size;
 	unsigned long  st_blksize;
 	unsigned long  st_blksize;
 	unsigned long  st_blocks;
 	unsigned long  st_blocks;
-	unsigned long  st_atime;
+	struct timespec st_atim;
-	unsigned long  __unused1;
+	struct timespec st_mtim;
-	unsigned long  st_mtime;
+	struct timespec st_ctim;
-	unsigned long  __unused2;
-	unsigned long  st_ctime;
-	unsigned long  __unused3;
 	unsigned long  __unused4;
 	unsigned long  __unused4;
 	unsigned long  __unused5;
 	unsigned long  __unused5;
 };
 };
@@ -69,14 +52,9 @@ struct kernel_stat64 {
 	unsigned long	st_blocks;	/* Number 512-byte blocks allocated. */
 	unsigned long	st_blocks;	/* Number 512-byte blocks allocated. */
 	unsigned long	__pad4;		/* future possible st_blocks high bits */
 	unsigned long	__pad4;		/* future possible st_blocks high bits */
 
 
-	unsigned long	st_atime;
+	struct timespec	st_atim;
-	unsigned long	__pad5;
+	struct timespec	st_mtim;
-
+	struct timespec	st_ctim;
-	unsigned long	st_mtime;
-	unsigned long	__pad6;
-
-	unsigned long	st_ctime;
-	unsigned long	__pad7;		/* will be high 32 bits of ctime someday */
 
 
 	unsigned long long	st_ino;
 	unsigned long long	st_ino;
 };
 };

+ 6 - 12
libc/sysdeps/linux/e1/bits/kernel_stat.h

@@ -22,12 +22,9 @@ struct kernel_stat {
 	unsigned long  st_size;
 	unsigned long  st_size;
 	unsigned long  st_blksize;
 	unsigned long  st_blksize;
 	unsigned long  st_blocks;
 	unsigned long  st_blocks;
-	unsigned long  st_atime;
+	struct timespec st_atim;
-	unsigned long  __unused1;
+	struct timespec st_mtim;
-	unsigned long  st_mtime;
+	struct timespec st_ctim;
-	unsigned long  __unused2;
-	unsigned long  st_ctime;
-	unsigned long  __unused3;
 	unsigned long  __unused4;
 	unsigned long  __unused4;
 	unsigned long  __unused5;
 	unsigned long  __unused5;
 };
 };
@@ -47,12 +44,9 @@ struct kernel_stat64 {
 	unsigned long	st_blksize;
 	unsigned long	st_blksize;
 	unsigned long	st_blocks;	/* Number 512-byte blocks allocated. */
 	unsigned long	st_blocks;	/* Number 512-byte blocks allocated. */
 	unsigned long	__pad4;		/* future possible st_blocks high bits */
 	unsigned long	__pad4;		/* future possible st_blocks high bits */
-	unsigned long	st_atime;
+	struct timespec	st_atim;
-	unsigned long	__pad5;
+	struct timespec	st_mtim;
-	unsigned long	st_mtime;
+	struct timespec	st_ctim;
-	unsigned long	__pad6;
-	unsigned long	st_ctime;
-	unsigned long	__pad7;		/* will be high 32 bits of ctime someday */
 	unsigned long long	st_ino;
 	unsigned long long	st_ino;
 };
 };
 
 

+ 6 - 16
libc/sysdeps/linux/frv/bits/kernel_stat.h

@@ -38,14 +38,9 @@ struct kernel_stat {
 	unsigned long __pad10;	/* future possible st_blocks high bits */
 	unsigned long __pad10;	/* future possible st_blocks high bits */
 	unsigned long st_blocks;	/* Number 512-byte blocks allocated. */
 	unsigned long st_blocks;	/* Number 512-byte blocks allocated. */
 
 
-	unsigned long __unused1;
+	struct timespec st_atim;
-	unsigned long st_atime;
+	struct timespec st_mtim;
-
+	struct timespec st_ctim;
-	unsigned long __unused2;
-	unsigned long st_mtime;
-
-	unsigned long __unused3;
-	unsigned long st_ctime;
 
 
 	unsigned long long __unused4;
 	unsigned long long __unused4;
 };
 };
@@ -73,14 +68,9 @@ struct kernel_stat64 {
 	unsigned long __pad4;		/* future possible st_blocks high bits */
 	unsigned long __pad4;		/* future possible st_blocks high bits */
 	unsigned long st_blocks;	/* Number 512-byte blocks allocated. */
 	unsigned long st_blocks;	/* Number 512-byte blocks allocated. */
 
 
-	unsigned long __unused1;
+	struct timespec st_atim;
-	unsigned long st_atime;
+	struct timespec st_mtim;
-
+	struct timespec st_ctim;
-	unsigned long __unused2;
-	unsigned long st_mtime;
-
-	unsigned long __unused3;	/* will be high 32 bits of ctime someday */
-	unsigned long st_ctime;
 
 
 	unsigned long long __unused4;
 	unsigned long long __unused4;
 };
 };

+ 6 - 12
libc/sysdeps/linux/h8300/bits/kernel_stat.h

@@ -22,12 +22,9 @@ struct kernel_stat {
 	unsigned long  st_size;
 	unsigned long  st_size;
 	unsigned long  st_blksize;
 	unsigned long  st_blksize;
 	unsigned long  st_blocks;
 	unsigned long  st_blocks;
-	unsigned long  st_atime;
+	struct timespec st_atim;
-	unsigned long  __unused1;
+	struct timespec st_mtim;
-	unsigned long  st_mtime;
+	struct timespec st_ctim;
-	unsigned long  __unused2;
-	unsigned long  st_ctime;
-	unsigned long  __unused3;
 	unsigned long  __unused4;
 	unsigned long  __unused4;
 	unsigned long  __unused5;
 	unsigned long  __unused5;
 };
 };
@@ -47,12 +44,9 @@ struct kernel_stat64 {
 	unsigned long	st_blksize;
 	unsigned long	st_blksize;
 	unsigned long	st_blocks;	/* Number 512-byte blocks allocated. */
 	unsigned long	st_blocks;	/* Number 512-byte blocks allocated. */
 	unsigned long	__pad4;		/* future possible st_blocks high bits */
 	unsigned long	__pad4;		/* future possible st_blocks high bits */
-	unsigned long	st_atime;
+	struct timespec	st_atim;
-	unsigned long	__pad5;
+	struct timespec	st_mtim;
-	unsigned long	st_mtime;
+	struct timespec	st_ctim;
-	unsigned long	__pad6;
-	unsigned long	st_ctime;
-	unsigned long	__pad7;		/* will be high 32 bits of ctime someday */
 	unsigned long long	st_ino;
 	unsigned long long	st_ino;
 };
 };
 
 

+ 6 - 14
libc/sysdeps/linux/hppa/bits/kernel_stat.h

@@ -17,12 +17,9 @@ struct kernel_stat {
 	unsigned short	st_reserved2;	/* old st_gid */
 	unsigned short	st_reserved2;	/* old st_gid */
 	unsigned int	st_rdev;
 	unsigned int	st_rdev;
 	off_t		st_size;
 	off_t		st_size;
-	time_t		st_atime;
+	struct timespec	st_atim;
-	unsigned int	st_atime_nsec;
+	struct timespec	st_mtim;
-	time_t		st_mtime;
+	struct timespec	st_ctim;
-	unsigned int	st_mtime_nsec;
-	time_t		st_ctime;
-	unsigned int	st_ctime_nsec;
 	int		st_blksize;
 	int		st_blksize;
 	int		st_blocks;
 	int		st_blocks;
 	unsigned int	__unused1;	/* ACL stuff */
 	unsigned int	__unused1;	/* ACL stuff */
@@ -39,8 +36,6 @@ struct kernel_stat {
 	unsigned int	st_spare4[3];
 	unsigned int	st_spare4[3];
 };
 };
 
 
-#define STAT_HAVE_NSEC 1
-
 /* This is the struct that 32-bit userspace applications are expecting.
 /* This is the struct that 32-bit userspace applications are expecting.
  * How 64-bit apps are going to be compiled, I have no idea.  But at least
  * How 64-bit apps are going to be compiled, I have no idea.  But at least
  * this way, we don't have a wrapper in the kernel.
  * this way, we don't have a wrapper in the kernel.
@@ -60,12 +55,9 @@ struct kernel_stat64 {
 	signed int		st_blksize;
 	signed int		st_blksize;
 
 
 	signed long long	st_blocks;
 	signed long long	st_blocks;
-	signed int		st_atime;
+	struct timespec		st_atim;
-	unsigned int		st_atime_nsec;
+	struct timespec		st_mtim;
-	signed int		st_mtime;
+	struct timespec		st_ctim;
-	unsigned int		st_mtime_nsec;
-	signed int		st_ctime;
-	unsigned int		st_ctime_nsec;
 	unsigned long long	st_ino;
 	unsigned long long	st_ino;
 };
 };
 
 

+ 6 - 12
libc/sysdeps/linux/i386/bits/kernel_stat.h

@@ -21,12 +21,9 @@ struct kernel_stat {
 	unsigned long  st_size;
 	unsigned long  st_size;
 	unsigned long  st_blksize;
 	unsigned long  st_blksize;
 	unsigned long  st_blocks;
 	unsigned long  st_blocks;
-	unsigned long  st_atime;
+	struct timespec st_atim;
-	unsigned long  __unused1;
+	struct timespec st_mtim;
-	unsigned long  st_mtime;
+	struct timespec st_ctim;
-	unsigned long  __unused2;
-	unsigned long  st_ctime;
-	unsigned long  __unused3;
 	unsigned long  __unused4;
 	unsigned long  __unused4;
 	unsigned long  __unused5;
 	unsigned long  __unused5;
 };
 };
@@ -46,12 +43,9 @@ struct kernel_stat64 {
 	unsigned long	st_blksize;
 	unsigned long	st_blksize;
 	unsigned long	st_blocks;	/* Number 512-byte blocks allocated. */
 	unsigned long	st_blocks;	/* Number 512-byte blocks allocated. */
 	unsigned long	__pad4;		/* future possible st_blocks high bits */
 	unsigned long	__pad4;		/* future possible st_blocks high bits */
-	unsigned long	st_atime;
+	struct timespec	st_atim;
-	unsigned long	__pad5;
+	struct timespec	st_mtim;
-	unsigned long	st_mtime;
+	struct timespec	st_ctim;
-	unsigned long	__pad6;
-	unsigned long	st_ctime;
-	unsigned long	__pad7;		/* will be high 32 bits of ctime someday */
 	unsigned long long	st_ino;
 	unsigned long long	st_ino;
 };
 };
 
 

+ 3 - 27
libc/sysdeps/linux/ia64/bits/kernel_stat.h

@@ -23,38 +23,14 @@ struct kernel_stat {
 	unsigned int	__pad0;
 	unsigned int	__pad0;
 	unsigned long	st_rdev;
 	unsigned long	st_rdev;
 	unsigned long	st_size;
 	unsigned long	st_size;
-	unsigned long	st_atime;
+	struct timespec	st_atim;
-	unsigned long	st_atime_nsec;
+	struct timespec	st_mtim;
-	unsigned long	st_mtime;
+	struct timespec	st_ctim;
-	unsigned long	st_mtime_nsec;
-	unsigned long	st_ctime;
-	unsigned long	st_ctime_nsec;
 	unsigned long	st_blksize;
 	unsigned long	st_blksize;
 	long		st_blocks;
 	long		st_blocks;
 	unsigned long	__unused[3];
 	unsigned long	__unused[3];
 };
 };
 
 
-#define STAT_HAVE_NSEC 1
-
-struct __old_kernel_stat {
-	unsigned int	st_dev;
-	unsigned int	st_ino;
-	unsigned int	st_mode;
-	unsigned int	st_nlink;
-	unsigned int	st_uid;
-	unsigned int	st_gid;
-	unsigned int	st_rdev;
-	unsigned int	__pad1;
-	unsigned long	st_size;
-	unsigned long	st_atime;
-	unsigned long	st_mtime;
-	unsigned long	st_ctime;
-	unsigned int	st_blksize;
-	int		st_blocks;
-	unsigned int	__unused1;
-	unsigned int	__unused2;
-};
-
 /* ia64 stat64 is same as stat */
 /* ia64 stat64 is same as stat */
 #define kernel_stat64 kernel_stat
 #define kernel_stat64 kernel_stat
 
 

+ 2 - 2
libc/sysdeps/linux/ia64/bits/stat.h

@@ -39,7 +39,7 @@ struct stat
     int pad0;
     int pad0;
     __dev_t st_rdev;		/* Device number, if device.  */
     __dev_t st_rdev;		/* Device number, if device.  */
     __off_t st_size;		/* Size of file, in bytes.  */
     __off_t st_size;		/* Size of file, in bytes.  */
-#if 0 /*def __USE_MISC*/
+#ifdef __USE_MISC
     /* Nanosecond resolution timestamps are stored in a format
     /* Nanosecond resolution timestamps are stored in a format
        equivalent to 'struct timespec'.  This is the type used
        equivalent to 'struct timespec'.  This is the type used
        whenever possible but the Unix namespace rules do not allow the
        whenever possible but the Unix namespace rules do not allow the
@@ -78,7 +78,7 @@ struct stat64
     int pad0;
     int pad0;
     __dev_t st_rdev;		/* Device number, if device.  */
     __dev_t st_rdev;		/* Device number, if device.  */
     __off_t st_size;		/* Size of file, in bytes.  */
     __off_t st_size;		/* Size of file, in bytes.  */
-#if 0 /*def __USE_MISC*/
+#ifdef __USE_MISC
     /* Nanosecond resolution timestamps are stored in a format
     /* Nanosecond resolution timestamps are stored in a format
        equivalent to 'struct timespec'.  This is the type used
        equivalent to 'struct timespec'.  This is the type used
        whenever possible but the Unix namespace rules do not allow the
        whenever possible but the Unix namespace rules do not allow the

+ 6 - 12
libc/sysdeps/linux/m68k/bits/kernel_stat.h

@@ -22,12 +22,9 @@ struct kernel_stat {
 	unsigned long  st_size;
 	unsigned long  st_size;
 	unsigned long  st_blksize;
 	unsigned long  st_blksize;
 	unsigned long  st_blocks;
 	unsigned long  st_blocks;
-	unsigned long  st_atime;
+	struct timespec st_atim;
-	unsigned long  __unused1;
+	struct timespec st_mtim;
-	unsigned long  st_mtime;
+	struct timespec st_ctim;
-	unsigned long  __unused2;
-	unsigned long  st_ctime;
-	unsigned long  __unused3;
 	unsigned long  __unused4;
 	unsigned long  __unused4;
 	unsigned long  __unused5;
 	unsigned long  __unused5;
 };
 };
@@ -49,12 +46,9 @@ struct kernel_stat64 {
 	unsigned long	st_blksize;
 	unsigned long	st_blksize;
 	unsigned long	__pad4;		/* future possible st_blocks high bits */
 	unsigned long	__pad4;		/* future possible st_blocks high bits */
 	unsigned long	st_blocks;	/* Number 512-byte blocks allocated. */
 	unsigned long	st_blocks;	/* Number 512-byte blocks allocated. */
-	unsigned long	st_atime;
+	struct timespec	st_atim;
-	unsigned long	__pad5;
+	struct timespec	st_mtim;
-	unsigned long	st_mtime;
+	struct timespec	st_ctim;
-	unsigned long	__pad6;
-	unsigned long	st_ctime;
-	unsigned long	__pad7;		/* will be high 32 bits of ctime someday */
 	unsigned long long	st_ino;
 	unsigned long long	st_ino;
 };
 };
 
 

+ 2 - 2
libc/sysdeps/linux/m68k/bits/stat.h

@@ -61,7 +61,7 @@ struct stat
 #else
 #else
     __blkcnt64_t st_blocks;		/* Number 512-byte blocks allocated. */
     __blkcnt64_t st_blocks;		/* Number 512-byte blocks allocated. */
 #endif
 #endif
-#if 0 /*def __USE_MISC*/
+#ifdef __USE_MISC
     /* Nanosecond resolution timestamps are stored in a format
     /* Nanosecond resolution timestamps are stored in a format
        equivalent to 'struct timespec'.  This is the type used
        equivalent to 'struct timespec'.  This is the type used
        whenever possible but the Unix namespace rules do not allow the
        whenever possible but the Unix namespace rules do not allow the
@@ -107,7 +107,7 @@ struct stat64
     __blksize_t st_blksize;		/* Optimal block size for I/O.  */
     __blksize_t st_blksize;		/* Optimal block size for I/O.  */
 
 
     __blkcnt64_t st_blocks;		/* Number 512-byte blocks allocated. */
     __blkcnt64_t st_blocks;		/* Number 512-byte blocks allocated. */
-#if 0 /*def __USE_MISC*/
+#ifdef __USE_MISC
     /* Nanosecond resolution timestamps are stored in a format
     /* Nanosecond resolution timestamps are stored in a format
        equivalent to 'struct timespec'.  This is the type used
        equivalent to 'struct timespec'.  This is the type used
        whenever possible but the Unix namespace rules do not allow the
        whenever possible but the Unix namespace rules do not allow the

+ 6 - 14
libc/sysdeps/linux/microblaze/bits/kernel_stat.h

@@ -19,12 +19,9 @@ struct kernel_stat
   __kernel_off_t	st_size;
   __kernel_off_t	st_size;
 	unsigned long  st_blksize;
 	unsigned long  st_blksize;
 	unsigned long  st_blocks;
 	unsigned long  st_blocks;
-	unsigned long  st_atime;
+	struct timespec st_atim;
-	unsigned long  __unused1;
+	struct timespec st_mtim;
-	unsigned long  st_mtime;
+	struct timespec st_ctim;
-	unsigned long  __unused2;
-	unsigned long  st_ctime;
-	unsigned long  __unused3;
 	unsigned long  __unused4;
 	unsigned long  __unused4;
 	unsigned long  __unused5;
 	unsigned long  __unused5;
 };
 };
@@ -53,14 +50,9 @@ struct kernel_stat64
   unsigned long		__unused4; /* future possible st_blocks high bits */
   unsigned long		__unused4; /* future possible st_blocks high bits */
 	unsigned long	st_blocks;	/* Number 512-byte blocks allocated. */
 	unsigned long	st_blocks;	/* Number 512-byte blocks allocated. */
 
 
-	unsigned long	st_atime;
+  struct timespec	st_atim;
-  unsigned long		__unused5;
+  struct timespec	st_mtim;
-
+  struct timespec	st_ctim;
-	unsigned long	st_mtime;
-  unsigned long		__unused6;
-
-	unsigned long	st_ctime;
-  unsigned long		__unused7; /* high 32 bits of ctime someday */
 };
 };
 
 
 #endif	/*  _BITS_STAT_STRUCT_H */
 #endif	/*  _BITS_STAT_STRUCT_H */

+ 12 - 26
libc/sysdeps/linux/mips/bits/kernel_stat.h

@@ -24,12 +24,9 @@ struct kernel_stat {
 	__kernel_dev_t	st_rdev;
 	__kernel_dev_t	st_rdev;
 	unsigned int	st_pad2[3];
 	unsigned int	st_pad2[3];
 	__kernel_off_t	st_size;
 	__kernel_off_t	st_size;
-	unsigned int	st_atime;
+	struct timespec	st_atim;
-	unsigned int	st_atime_nsec;
+	struct timespec	st_mtim;
-	unsigned int	st_mtime;
+	struct timespec	st_ctim;
-	unsigned int	st_mtime_nsec;
-	unsigned int	st_ctime;
-	unsigned int	st_ctime_nsec;
 	unsigned int	st_blksize;
 	unsigned int	st_blksize;
 	unsigned int	reserved3;
 	unsigned int	reserved3;
 	unsigned long	st_blocks;
 	unsigned long	st_blocks;
@@ -48,12 +45,9 @@ struct kernel_stat {
 	unsigned int	st_rdev;
 	unsigned int	st_rdev;
 	unsigned int	st_pad2[3];
 	unsigned int	st_pad2[3];
 	unsigned long long	st_size;
 	unsigned long long	st_size;
-	unsigned int	st_atime;
+	struct timespec	st_atim;
-	unsigned int	st_atime_nsec;
+	struct timespec	st_mtim;
-	unsigned int	st_mtime;
+	struct timespec	st_ctim;
-	unsigned int	st_mtime_nsec;
-	unsigned int	st_ctime;
-	unsigned int	st_ctime_nsec;
 	unsigned int	st_blksize;
 	unsigned int	st_blksize;
 	unsigned int	reserved3;
 	unsigned int	reserved3;
 	unsigned long long	st_blocks;
 	unsigned long long	st_blocks;
@@ -72,12 +66,9 @@ struct kernel_stat {
 	long		st_pad2[2];
 	long		st_pad2[2];
 	__kernel_off_t	st_size;
 	__kernel_off_t	st_size;
 	long		st_pad3;
 	long		st_pad3;
-	time_t		st_atime;
+	struct timespec	st_atim;
-	long		st_atime_nsec;
+	struct timespec	st_mtim;
-	time_t		st_mtime;
+	struct timespec	st_ctim;
-	long		st_mtime_nsec;
-	time_t		st_ctime;
-	long		st_ctime_nsec;
 	long		st_blksize;
 	long		st_blksize;
 	long		st_blocks;
 	long		st_blocks;
 	long		st_pad4[14];
 	long		st_pad4[14];
@@ -94,19 +85,14 @@ struct kernel_stat64 {
 	unsigned long	st_rdev;
 	unsigned long	st_rdev;
 	unsigned long	st_pad1[3];	/* Reserved for st_rdev expansion  */
 	unsigned long	st_pad1[3];	/* Reserved for st_rdev expansion  */
 	long long	st_size;
 	long long	st_size;
-	time_t		st_atime;
+	struct timespec	st_atim;
-	unsigned long	st_atime_nsec;
+	struct timespec	st_mtim;
-	time_t		st_mtime;
+	struct timespec	st_ctim;
-	unsigned long	st_mtime_nsec;
-	time_t		st_ctime;
-	unsigned long	st_ctime_nsec;
 	unsigned long	st_blksize;
 	unsigned long	st_blksize;
 	unsigned long	st_pad2;
 	unsigned long	st_pad2;
 	long long	st_blocks;
 	long long	st_blocks;
 };
 };
 #endif	/* O32 */
 #endif	/* O32 */
 
 
-#define STAT_HAVE_NSEC 1
-
 #endif	/*  _BITS_STAT_STRUCT_H */
 #endif	/*  _BITS_STAT_STRUCT_H */
 
 

+ 62 - 16
libc/sysdeps/linux/mips/bits/stat.h

@@ -61,16 +61,27 @@ struct stat
     long int st_pad2[2];
     long int st_pad2[2];
     __off64_t st_size;		/* Size of file, in bytes.  */
     __off64_t st_size;		/* Size of file, in bytes.  */
 #endif
 #endif
-    /*
+#ifdef __USE_MISC
-     * Actually this should be timestruc_t st_atime, st_mtime and
+    /* Nanosecond resolution timestamps are stored in a format
-     * st_ctime but we don't have it under Linux.
+       equivalent to 'struct timespec'.  This is the type used
-     */
+       whenever possible but the Unix namespace rules do not allow the
+       identifier 'timespec' to appear in the <sys/stat.h> header.
+       Therefore we have to handle the use of this header in strictly
+       standard-compliant sources special.  */
+    struct timespec st_atim;            /* Time of last access.  */
+    struct timespec st_mtim;            /* Time of last modification.  */
+    struct timespec st_ctim;            /* Time of last status change.  */
+# define st_atime st_atim.tv_sec        /* Backward compatibility.  */
+# define st_mtime st_mtim.tv_sec
+# define st_ctime st_ctim.tv_sec
+#else
     __time_t st_atime;		/* Time of last access.  */
     __time_t st_atime;		/* Time of last access.  */
     unsigned long int st_atimensec;	/* Nscecs of last access.  */
     unsigned long int st_atimensec;	/* Nscecs of last access.  */
     __time_t st_mtime;		/* Time of last modification.  */
     __time_t st_mtime;		/* Time of last modification.  */
     unsigned long int st_mtimensec;	/* Nsecs of last modification.  */
     unsigned long int st_mtimensec;	/* Nsecs of last modification.  */
     __time_t st_ctime;		/* Time of last status change.  */
     __time_t st_ctime;		/* Time of last status change.  */
     unsigned long int st_ctimensec;	/* Nsecs of last status change.  */
     unsigned long int st_ctimensec;	/* Nsecs of last status change.  */
+#endif
     __blksize_t st_blksize;	/* Optimal block size for I/O.  */
     __blksize_t st_blksize;	/* Optimal block size for I/O.  */
 #ifndef __USE_FILE_OFFSET64
 #ifndef __USE_FILE_OFFSET64
     __blkcnt_t st_blocks;	/* Number of 512-byte blocks allocated.  */
     __blkcnt_t st_blocks;	/* Number of 512-byte blocks allocated.  */
@@ -93,16 +104,27 @@ struct stat {
     unsigned int st_rdev;	/* Device number, if device.  */
     unsigned int st_rdev;	/* Device number, if device.  */
     int st_pad2[3];
     int st_pad2[3];
     __off_t st_size;		/* Size of file, in bytes.  */
     __off_t st_size;		/* Size of file, in bytes.  */
-    /*
+#ifdef __USE_MISC
-     * Actually this should be timestruc_t st_atime, st_mtime and
+    /* Nanosecond resolution timestamps are stored in a format
-     * st_ctime but we don't have it under Linux.
+       equivalent to 'struct timespec'.  This is the type used
-     */
+       whenever possible but the Unix namespace rules do not allow the
+       identifier 'timespec' to appear in the <sys/stat.h> header.
+       Therefore we have to handle the use of this header in strictly
+       standard-compliant sources special.  */
+    struct timespec st_atim;            /* Time of last access.  */
+    struct timespec st_mtim;            /* Time of last modification.  */
+    struct timespec st_ctim;            /* Time of last status change.  */
+# define st_atime st_atim.tv_sec        /* Backward compatibility.  */
+# define st_mtime st_mtim.tv_sec
+# define st_ctime st_ctim.tv_sec
+#else
     int st_atime;
     int st_atime;
     int st_atimensec;
     int st_atimensec;
     int st_mtime;
     int st_mtime;
     int st_mtimensec;
     int st_mtimensec;
     int st_ctime;
     int st_ctime;
     int st_ctimensec;
     int st_ctimensec;
+#endif
     int st_blksize;	/* Optimal block size for I/O.  */
     int st_blksize;	/* Optimal block size for I/O.  */
     int st_pad3;
     int st_pad3;
     __blkcnt_t st_blocks;	/* Number of 512-byte blocks allocated.  */
     __blkcnt_t st_blocks;	/* Number of 512-byte blocks allocated.  */
@@ -124,16 +146,27 @@ struct stat64
     __dev_t st_rdev;	/* Device number, if device.  */
     __dev_t st_rdev;	/* Device number, if device.  */
     long int st_pad2[2];
     long int st_pad2[2];
     __off64_t st_size;		/* Size of file, in bytes.  */
     __off64_t st_size;		/* Size of file, in bytes.  */
-    /*
+#ifdef __USE_MISC
-     * Actually this should be timestruc_t st_atime, st_mtime and
+    /* Nanosecond resolution timestamps are stored in a format
-     * st_ctime but we don't have it under Linux.
+       equivalent to 'struct timespec'.  This is the type used
-     */
+       whenever possible but the Unix namespace rules do not allow the
+       identifier 'timespec' to appear in the <sys/stat.h> header.
+       Therefore we have to handle the use of this header in strictly
+       standard-compliant sources special.  */
+    struct timespec st_atim;            /* Time of last access.  */
+    struct timespec st_mtim;            /* Time of last modification.  */
+    struct timespec st_ctim;            /* Time of last status change.  */
+# define st_atime st_atim.tv_sec        /* Backward compatibility.  */
+# define st_mtime st_mtim.tv_sec
+# define st_ctime st_ctim.tv_sec
+#else
     __time_t st_atime;		/* Time of last access.  */
     __time_t st_atime;		/* Time of last access.  */
     unsigned long int st_atimensec;	/* Nscecs of last access.  */
     unsigned long int st_atimensec;	/* Nscecs of last access.  */
     __time_t st_mtime;		/* Time of last modification.  */
     __time_t st_mtime;		/* Time of last modification.  */
     unsigned long int st_mtimensec;	/* Nsecs of last modification.  */
     unsigned long int st_mtimensec;	/* Nsecs of last modification.  */
     __time_t st_ctime;		/* Time of last status change.  */
     __time_t st_ctime;		/* Time of last status change.  */
     unsigned long int st_ctimensec;	/* Nsecs of last status change.  */
     unsigned long int st_ctimensec;	/* Nsecs of last status change.  */
+#endif
     __blksize_t st_blksize;	/* Optimal block size for I/O.  */
     __blksize_t st_blksize;	/* Optimal block size for I/O.  */
     long int st_pad3;
     long int st_pad3;
     __blkcnt64_t st_blocks;	/* Number of 512-byte blocks allocated.  */
     __blkcnt64_t st_blocks;	/* Number of 512-byte blocks allocated.  */
@@ -152,16 +185,27 @@ struct stat64 {
     unsigned int st_rdev;	/* Device number, if device.  */
     unsigned int st_rdev;	/* Device number, if device.  */
     int st_pad2[3];
     int st_pad2[3];
     __off_t st_size;		/* Size of file, in bytes.  */
     __off_t st_size;		/* Size of file, in bytes.  */
-    /*
+#ifdef __USE_MISC
-     * Actually this should be timestruc_t st_atime, st_mtime and
+    /* Nanosecond resolution timestamps are stored in a format
-     * st_ctime but we don't have it under Linux.
+       equivalent to 'struct timespec'.  This is the type used
-     */
+       whenever possible but the Unix namespace rules do not allow the
+       identifier 'timespec' to appear in the <sys/stat.h> header.
+       Therefore we have to handle the use of this header in strictly
+       standard-compliant sources special.  */
+    struct timespec st_atim;            /* Time of last access.  */
+    struct timespec st_mtim;            /* Time of last modification.  */
+    struct timespec st_ctim;            /* Time of last status change.  */
+# define st_atime st_atim.tv_sec        /* Backward compatibility.  */
+# define st_mtime st_mtim.tv_sec
+# define st_ctime st_ctim.tv_sec
+#else
     int st_atime;
     int st_atime;
     int st_atimensec;
     int st_atimensec;
     int st_mtime;
     int st_mtime;
     int st_mtimensec;
     int st_mtimensec;
     int st_ctime;
     int st_ctime;
     int st_ctimensec;
     int st_ctimensec;
+#endif
     int st_blksize;	/* Optimal block size for I/O.  */
     int st_blksize;	/* Optimal block size for I/O.  */
     int st_pad3;
     int st_pad3;
     __blkcnt_t st_blocks;	/* Number of 512-byte blocks allocated.  */
     __blkcnt_t st_blocks;	/* Number of 512-byte blocks allocated.  */
@@ -173,6 +217,8 @@ struct stat64 {
 /* Tell code we have these members.  */
 /* Tell code we have these members.  */
 #define	_STATBUF_ST_BLKSIZE
 #define	_STATBUF_ST_BLKSIZE
 #define	_STATBUF_ST_RDEV
 #define	_STATBUF_ST_RDEV
+/* Nanosecond resolution time values are supported.  */
+#define _STATBUF_ST_NSEC
 
 
 /* Encoding of the file mode.  */
 /* Encoding of the file mode.  */
 
 

+ 35 - 6
libc/sysdeps/linux/nios/bits/stat.h

@@ -60,12 +60,27 @@ struct stat
 #else
 #else
     __blkcnt64_t st_blocks;		/* Number 512-byte blocks allocated. */
     __blkcnt64_t st_blocks;		/* Number 512-byte blocks allocated. */
 #endif
 #endif
+#ifdef __USE_MISC
+    /* Nanosecond resolution timestamps are stored in a format
+       equivalent to 'struct timespec'.  This is the type used
+       whenever possible but the Unix namespace rules do not allow the
+       identifier 'timespec' to appear in the <sys/stat.h> header.
+       Therefore we have to handle the use of this header in strictly
+       standard-compliant sources special.  */
+    struct timespec st_atim;		/* Time of last access.  */
+    struct timespec st_mtim;		/* Time of last modification.  */
+    struct timespec st_ctim;		/* Time of last status change.  */
+# define st_atime st_atim.tv_sec	/* Backward compatibility.  */
+# define st_mtime st_mtim.tv_sec
+# define st_ctime st_ctim.tv_sec
+#else
     __time_t st_atime;			/* Time of last access.  */
     __time_t st_atime;			/* Time of last access.  */
-    unsigned long int __unused1;
+    unsigned long int st_atimensec;	/* Nscecs of last access.  */
     __time_t st_mtime;			/* Time of last modification.  */
     __time_t st_mtime;			/* Time of last modification.  */
-    unsigned long int __unused2;
+    unsigned long int st_mtimensec;	/* Nsecs of last modification.  */
     __time_t st_ctime;			/* Time of last status change.  */
     __time_t st_ctime;			/* Time of last status change.  */
-    unsigned long int __unused3;
+    unsigned long int st_ctimensec;	/* Nsecs of last status change.  */
+#endif
 #ifndef __USE_FILE_OFFSET64
 #ifndef __USE_FILE_OFFSET64
     unsigned long int __unused4;
     unsigned long int __unused4;
     unsigned long int __unused5;
     unsigned long int __unused5;
@@ -91,12 +106,24 @@ struct stat64
     __blksize_t st_blksize;		/* Optimal block size for I/O.  */
     __blksize_t st_blksize;		/* Optimal block size for I/O.  */
 
 
     __blkcnt64_t st_blocks;		/* Number 512-byte blocks allocated. */
     __blkcnt64_t st_blocks;		/* Number 512-byte blocks allocated. */
+#ifdef __USE_MISC
+    /* Nanosecond resolution timestamps are stored in a format
+       equivalent to 'struct timespec'.  This is the type used
+       whenever possible but the Unix namespace rules do not allow the
+       identifier 'timespec' to appear in the <sys/stat.h> header.
+       Therefore we have to handle the use of this header in strictly
+       standard-compliant sources special.  */
+    struct timespec st_atim;		/* Time of last access.  */
+    struct timespec st_mtim;		/* Time of last modification.  */
+    struct timespec st_ctim;		/* Time of last status change.  */
+#else
     __time_t st_atime;			/* Time of last access.  */
     __time_t st_atime;			/* Time of last access.  */
-    unsigned long int __unused1;
+    unsigned long int st_atimensec;	/* Nscecs of last access.  */
     __time_t st_mtime;			/* Time of last modification.  */
     __time_t st_mtime;			/* Time of last modification.  */
-    unsigned long int __unused2;
+    unsigned long int st_mtimensec;	/* Nsecs of last modification.  */
     __time_t st_ctime;			/* Time of last status change.  */
     __time_t st_ctime;			/* Time of last status change.  */
-    unsigned long int __unused3;
+    unsigned long int st_ctimensec;	/* Nsecs of last status change.  */
+#endif
     __ino64_t st_ino;			/* File serial number.		*/
     __ino64_t st_ino;			/* File serial number.		*/
   };
   };
 #endif
 #endif
@@ -104,6 +131,8 @@ struct stat64
 /* Tell code we have these members.  */
 /* Tell code we have these members.  */
 #define	_STATBUF_ST_BLKSIZE
 #define	_STATBUF_ST_BLKSIZE
 #define _STATBUF_ST_RDEV
 #define _STATBUF_ST_RDEV
+/* Nanosecond resolution time values are supported.  */
+#define _STATBUF_ST_NSEC
 
 
 /* Encoding of the file mode.  */
 /* Encoding of the file mode.  */
 
 

+ 6 - 12
libc/sysdeps/linux/nios2/bits/kernel_stat.h

@@ -22,12 +22,9 @@ struct kernel_stat {
 	unsigned long  st_size;
 	unsigned long  st_size;
 	unsigned long  st_blksize;
 	unsigned long  st_blksize;
 	unsigned long  st_blocks;
 	unsigned long  st_blocks;
-	unsigned long  st_atime;
+	struct timespec st_atim;
-	unsigned long  __unused1;
+	struct timespec st_mtim;
-	unsigned long  st_mtime;
+	struct timespec st_ctim;
-	unsigned long  __unused2;
-	unsigned long  st_ctime;
-	unsigned long  __unused3;
 	unsigned long  __unused4;
 	unsigned long  __unused4;
 	unsigned long  __unused5;
 	unsigned long  __unused5;
 };
 };
@@ -47,12 +44,9 @@ struct kernel_stat64 {
 	unsigned long	st_blksize;
 	unsigned long	st_blksize;
 	unsigned long	st_blocks;	/* Number 512-byte blocks allocated. */
 	unsigned long	st_blocks;	/* Number 512-byte blocks allocated. */
 	unsigned long	__pad4;		/* future possible st_blocks high bits */
 	unsigned long	__pad4;		/* future possible st_blocks high bits */
-	unsigned long	st_atime;
+	struct timespec	st_atim;
-	unsigned long	__pad5;
+	struct timespec	st_mtim;
-	unsigned long	st_mtime;
+	struct timespec	st_ctim;
-	unsigned long	__pad6;
-	unsigned long	st_ctime;
-	unsigned long	__pad7;		/* will be high 32 bits of ctime someday */
 	unsigned long long	st_ino;
 	unsigned long long	st_ino;
 };
 };
 
 

+ 35 - 6
libc/sysdeps/linux/nios2/bits/stat.h

@@ -60,12 +60,27 @@ struct stat
 #else
 #else
     __blkcnt64_t st_blocks;		/* Number 512-byte blocks allocated. */
     __blkcnt64_t st_blocks;		/* Number 512-byte blocks allocated. */
 #endif
 #endif
+#ifdef __USE_MISC
+    /* Nanosecond resolution timestamps are stored in a format
+       equivalent to 'struct timespec'.  This is the type used
+       whenever possible but the Unix namespace rules do not allow the
+       identifier 'timespec' to appear in the <sys/stat.h> header.
+       Therefore we have to handle the use of this header in strictly
+       standard-compliant sources special.  */
+    struct timespec st_atim;		/* Time of last access.  */
+    struct timespec st_mtim;		/* Time of last modification.  */
+    struct timespec st_ctim;		/* Time of last status change.  */
+# define st_atime st_atim.tv_sec	/* Backward compatibility.  */
+# define st_mtime st_mtim.tv_sec
+# define st_ctime st_ctim.tv_sec
+#else
     __time_t st_atime;			/* Time of last access.  */
     __time_t st_atime;			/* Time of last access.  */
-    unsigned long int __unused1;
+    unsigned long int st_atimensec;	/* Nscecs of last access.  */
     __time_t st_mtime;			/* Time of last modification.  */
     __time_t st_mtime;			/* Time of last modification.  */
-    unsigned long int __unused2;
+    unsigned long int st_mtimensec;	/* Nsecs of last modification.  */
     __time_t st_ctime;			/* Time of last status change.  */
     __time_t st_ctime;			/* Time of last status change.  */
-    unsigned long int __unused3;
+    unsigned long int st_ctimensec;	/* Nsecs of last status change.  */
+#endif
 #ifndef __USE_FILE_OFFSET64
 #ifndef __USE_FILE_OFFSET64
     unsigned long int __unused4;
     unsigned long int __unused4;
     unsigned long int __unused5;
     unsigned long int __unused5;
@@ -91,12 +106,24 @@ struct stat64
     __blksize_t st_blksize;		/* Optimal block size for I/O.  */
     __blksize_t st_blksize;		/* Optimal block size for I/O.  */
 
 
     __blkcnt64_t st_blocks;		/* Number 512-byte blocks allocated. */
     __blkcnt64_t st_blocks;		/* Number 512-byte blocks allocated. */
+#ifdef __USE_MISC
+    /* Nanosecond resolution timestamps are stored in a format
+       equivalent to 'struct timespec'.  This is the type used
+       whenever possible but the Unix namespace rules do not allow the
+       identifier 'timespec' to appear in the <sys/stat.h> header.
+       Therefore we have to handle the use of this header in strictly
+       standard-compliant sources special.  */
+    struct timespec st_atim;		/* Time of last access.  */
+    struct timespec st_mtim;		/* Time of last modification.  */
+    struct timespec st_ctim;		/* Time of last status change.  */
+#else
     __time_t st_atime;			/* Time of last access.  */
     __time_t st_atime;			/* Time of last access.  */
-    unsigned long int __unused1;
+    unsigned long int st_atimensec;	/* Nscecs of last access.  */
     __time_t st_mtime;			/* Time of last modification.  */
     __time_t st_mtime;			/* Time of last modification.  */
-    unsigned long int __unused2;
+    unsigned long int st_mtimensec;	/* Nsecs of last modification.  */
     __time_t st_ctime;			/* Time of last status change.  */
     __time_t st_ctime;			/* Time of last status change.  */
-    unsigned long int __unused3;
+    unsigned long int st_ctimensec;	/* Nsecs of last status change.  */
+#endif
     __ino64_t st_ino;			/* File serial number.		*/
     __ino64_t st_ino;			/* File serial number.		*/
   };
   };
 #endif
 #endif
@@ -104,6 +131,8 @@ struct stat64
 /* Tell code we have these members.  */
 /* Tell code we have these members.  */
 #define	_STATBUF_ST_BLKSIZE
 #define	_STATBUF_ST_BLKSIZE
 #define _STATBUF_ST_RDEV
 #define _STATBUF_ST_RDEV
+/* Nanosecond resolution time values are supported.  */
+#define _STATBUF_ST_NSEC
 
 
 /* Encoding of the file mode.  */
 /* Encoding of the file mode.  */
 
 

+ 7 - 12
libc/sysdeps/linux/powerpc/bits/kernel_stat.h

@@ -8,6 +8,7 @@
 /* This file provides whatever this particular arch's kernel thinks
 /* This file provides whatever this particular arch's kernel thinks
  * struct kernel_stat should look like...  It turns out each arch has a
  * struct kernel_stat should look like...  It turns out each arch has a
  * different opinion on the subject... */
  * different opinion on the subject... */
+
 #if __WORDSIZE == 64
 #if __WORDSIZE == 64
 #define kernel_stat kernel_stat64
 #define kernel_stat kernel_stat64
 #else
 #else
@@ -22,12 +23,9 @@ struct kernel_stat {
 	__kernel_off_t	st_size;
 	__kernel_off_t	st_size;
 	unsigned long  	st_blksize;
 	unsigned long  	st_blksize;
 	unsigned long  	st_blocks;
 	unsigned long  	st_blocks;
-	unsigned long  	st_atime;
+	struct timespec	st_atim;
-	unsigned long  	__unused1;
+	struct timespec	st_mtim;
-	unsigned long  	st_mtime;
+	struct timespec	st_ctim;
-	unsigned long  	__unused2;
-	unsigned long  	st_ctime;
-	unsigned long  	__unused3;
 	unsigned long  	__unused4;
 	unsigned long  	__unused4;
 	unsigned long  	__unused5;
 	unsigned long  	__unused5;
 };
 };
@@ -45,12 +43,9 @@ struct kernel_stat64 {
 	long long st_size;		/* Size of file, in bytes.  */
 	long long st_size;		/* Size of file, in bytes.  */
 	long st_blksize;		/* Optimal block size for I/O.  */
 	long st_blksize;		/* Optimal block size for I/O.  */
 	long long st_blocks;		/* Number 512-byte blocks allocated. */
 	long long st_blocks;		/* Number 512-byte blocks allocated. */
-	long st_atime;			/* Time of last access.  */
+	struct timespec st_atim;	/* Time of last access.  */
-	unsigned long int __unused1;
+	struct timespec st_mtim;	/* Time of last modification.  */
-	long st_mtime;			/* Time of last modification.  */
+	struct timespec st_ctim;	/* Time of last status change.  */
-	unsigned long int __unused2;
-	long st_ctime;			/* Time of last status change.  */
-	unsigned long int __unused3;
 	unsigned long int __unused4;
 	unsigned long int __unused4;
 	unsigned long int __unused5;
 	unsigned long int __unused5;
 };
 };

+ 4 - 4
libc/sysdeps/linux/powerpc/bits/stat.h

@@ -69,7 +69,7 @@ struct stat
 # else
 # else
     __blkcnt64_t st_blocks;		/* Number 512-byte blocks allocated. */
     __blkcnt64_t st_blocks;		/* Number 512-byte blocks allocated. */
 # endif
 # endif
-#if 0 /*def __USE_MISC*/
+#ifdef __USE_MISC
     /* Nanosecond resolution timestamps are stored in a format
     /* Nanosecond resolution timestamps are stored in a format
        equivalent to 'struct timespec'.  This is the type used
        equivalent to 'struct timespec'.  This is the type used
        whenever possible but the Unix namespace rules do not allow the
        whenever possible but the Unix namespace rules do not allow the
@@ -109,7 +109,7 @@ struct stat64
     __off64_t st_size;			/* Size of file, in bytes.  */
     __off64_t st_size;			/* Size of file, in bytes.  */
     __blksize_t st_blksize;		/* Optimal block size for I/O.  */
     __blksize_t st_blksize;		/* Optimal block size for I/O.  */
     __blkcnt64_t st_blocks;		/* Number 512-byte blocks allocated. */
     __blkcnt64_t st_blocks;		/* Number 512-byte blocks allocated. */
-#if 0 /*def __USE_MISC*/
+#ifdef __USE_MISC
     /* Nanosecond resolution timestamps are stored in a format
     /* Nanosecond resolution timestamps are stored in a format
        equivalent to 'struct timespec'.  This is the type used
        equivalent to 'struct timespec'.  This is the type used
        whenever possible but the Unix namespace rules do not allow the
        whenever possible but the Unix namespace rules do not allow the
@@ -163,7 +163,7 @@ struct stat
 # else
 # else
     __blkcnt64_t st_blocks;		/* Number 512-byte blocks allocated. */
     __blkcnt64_t st_blocks;		/* Number 512-byte blocks allocated. */
 # endif
 # endif
-#if 0 /*def __USE_MISC*/
+#ifdef __USE_MISC
     /* Nanosecond resolution timestamps are stored in a format
     /* Nanosecond resolution timestamps are stored in a format
        equivalent to 'struct timespec'.  This is the type used
        equivalent to 'struct timespec'.  This is the type used
        whenever possible but the Unix namespace rules do not allow the
        whenever possible but the Unix namespace rules do not allow the
@@ -203,7 +203,7 @@ struct stat64
     __off64_t st_size;			/* Size of file, in bytes.  */
     __off64_t st_size;			/* Size of file, in bytes.  */
     __blksize_t st_blksize;		/* Optimal block size for I/O.  */
     __blksize_t st_blksize;		/* Optimal block size for I/O.  */
     __blkcnt64_t st_blocks;		/* Number 512-byte blocks allocated. */
     __blkcnt64_t st_blocks;		/* Number 512-byte blocks allocated. */
-#if 0 /*def __USE_MISC*/
+#ifdef __USE_MISC
     /* Nanosecond resolution timestamps are stored in a format
     /* Nanosecond resolution timestamps are stored in a format
        equivalent to 'struct timespec'.  This is the type used
        equivalent to 'struct timespec'.  This is the type used
        whenever possible but the Unix namespace rules do not allow the
        whenever possible but the Unix namespace rules do not allow the

+ 6 - 14
libc/sysdeps/linux/sh/bits/kernel_stat.h

@@ -23,12 +23,9 @@ struct kernel_stat {
 	unsigned long  st_size;
 	unsigned long  st_size;
 	unsigned long  st_blksize;
 	unsigned long  st_blksize;
 	unsigned long  st_blocks;
 	unsigned long  st_blocks;
-	unsigned long  st_atime;
+	struct timespec st_atim;
-	unsigned long  __unused1;
+	struct timespec st_mtim;
-	unsigned long  st_mtime;
+	struct timespec st_ctim;
-	unsigned long  __unused2;
-	unsigned long  st_ctime;
-	unsigned long  __unused3;
 	unsigned long  __unused4;
 	unsigned long  __unused4;
 	unsigned long  __unused5;
 	unsigned long  __unused5;
 };
 };
@@ -72,14 +69,9 @@ struct kernel_stat64 {
 	unsigned long	__pad4;		/* Future possible st_blocks hi bits */
 	unsigned long	__pad4;		/* Future possible st_blocks hi bits */
 #endif
 #endif
 
 
-	unsigned long	st_atime;
+	struct timespec	st_atim;
-	unsigned long	__pad5;
+	struct timespec	st_mtim;
-
+	struct timespec	st_ctim;
-	unsigned long	st_mtime;
-	unsigned long	__pad6;
-
-	unsigned long	st_ctime;
-	unsigned long	__pad7;		/* will be high 32 bits of ctime someday */
 
 
 	unsigned long	__unused1;
 	unsigned long	__unused1;
 	unsigned long	__unused2;
 	unsigned long	__unused2;

+ 6 - 14
libc/sysdeps/linux/sh64/bits/kernel_stat.h

@@ -20,12 +20,9 @@ struct kernel_stat {
 	unsigned long  st_size;
 	unsigned long  st_size;
 	unsigned long  st_blksize;
 	unsigned long  st_blksize;
 	unsigned long  st_blocks;
 	unsigned long  st_blocks;
-	unsigned long  st_atime;
+	struct timespec st_atim;
-	unsigned long  __unused1;
+	struct timespec st_mtim;
-	unsigned long  st_mtime;
+	struct timespec st_ctim;
-	unsigned long  __unused2;
-	unsigned long  st_ctime;
-	unsigned long  __unused3;
 	unsigned long  __unused4;
 	unsigned long  __unused4;
 	unsigned long  __unused5;
 	unsigned long  __unused5;
 };
 };
@@ -50,14 +47,9 @@ struct kernel_stat64 {
 	unsigned long	st_blocks;	/* Number 512-byte blocks allocated. */
 	unsigned long	st_blocks;	/* Number 512-byte blocks allocated. */
 	unsigned long	__pad4;		/* future possible st_blocks high bits */
 	unsigned long	__pad4;		/* future possible st_blocks high bits */
 
 
-	unsigned long	st_atime;
+	struct timespec	st_atim;
-	unsigned long	__pad5;
+	struct timespec	st_mtim;
-
+	struct timespec	st_ctim;
-	unsigned long	st_mtime;
-	unsigned long	__pad6;
-
-	unsigned long	st_ctime;
-	unsigned long	__pad7;		/* will be high 32 bits of ctime someday */
 
 
 	unsigned long	__unused1;
 	unsigned long	__unused1;
 	unsigned long	__unused2;
 	unsigned long	__unused2;

+ 7 - 12
libc/sysdeps/linux/sparc/bits/kernel_stat.h

@@ -8,6 +8,7 @@
 /* This file provides whatever this particular arch's kernel thinks
 /* This file provides whatever this particular arch's kernel thinks
  * struct kernel_stat should look like...  It turns out each arch has a
  * struct kernel_stat should look like...  It turns out each arch has a
  * different opinion on the subject... */
  * different opinion on the subject... */
+
 #if __WORDSIZE == 64
 #if __WORDSIZE == 64
 #define kernel_stat kernel_stat64
 #define kernel_stat kernel_stat64
 #else
 #else
@@ -20,12 +21,9 @@ struct kernel_stat {
     unsigned short	st_gid;
     unsigned short	st_gid;
     unsigned short	st_rdev;
     unsigned short	st_rdev;
     long		st_size;
     long		st_size;
-    long		st_atime;
+    struct timespec	st_atim;
-    unsigned long	__unused1;
+    struct timespec	st_mtim;
-    long		st_mtime;
+    struct timespec	st_ctim;
-    unsigned long	__unused2;
-    long		st_ctime;
-    unsigned long	__unused3;
     long		st_blksize;
     long		st_blksize;
     long		st_blocks;
     long		st_blocks;
     unsigned long	__unused4[2];
     unsigned long	__unused4[2];
@@ -46,12 +44,9 @@ struct kernel_stat64 {
 	unsigned int	st_blksize;
 	unsigned int	st_blksize;
 	unsigned char	__pad4[8];
 	unsigned char	__pad4[8];
 	unsigned int	st_blocks;
 	unsigned int	st_blocks;
-	unsigned int	st_atime;
+	struct timespec	st_atim;
-	unsigned int	st_atime_nsec;
+	struct timespec	st_mtim;
-	unsigned int	st_mtime;
+	struct timespec	st_ctim;
-	unsigned int	st_mtime_nsec;
-	unsigned int	st_ctime;
-	unsigned int	st_ctime_nsec;
 	unsigned int	__unused4;
 	unsigned int	__unused4;
 	unsigned int	__unused5;
 	unsigned int	__unused5;
 };
 };

+ 2 - 2
libc/sysdeps/linux/sparc/bits/stat.h

@@ -61,7 +61,7 @@ struct stat
 #else
 #else
     __blkcnt64_t st_blocks;		/* Number 512-byte blocks allocated. */
     __blkcnt64_t st_blocks;		/* Number 512-byte blocks allocated. */
 #endif
 #endif
-#if 0 /*def __USE_MISC*/
+#ifdef __USE_MISC
     /* Nanosecond resolution timestamps are stored in a format
     /* Nanosecond resolution timestamps are stored in a format
        equivalent to 'struct timespec'.  This is the type used
        equivalent to 'struct timespec'.  This is the type used
        whenever possible but the Unix namespace rules do not allow the
        whenever possible but the Unix namespace rules do not allow the
@@ -104,7 +104,7 @@ struct stat64
     __blksize_t st_blksize;		/* Optimal block size for I/O.  */
     __blksize_t st_blksize;		/* Optimal block size for I/O.  */
 
 
     __blkcnt64_t st_blocks;		/* Number 512-byte blocks allocated. */
     __blkcnt64_t st_blocks;		/* Number 512-byte blocks allocated. */
-#if 0 /*def __USE_MISC*/
+#ifdef __USE_MISC
     /* Nanosecond resolution timestamps are stored in a format
     /* Nanosecond resolution timestamps are stored in a format
        equivalent to 'struct timespec'.  This is the type used
        equivalent to 'struct timespec'.  This is the type used
        whenever possible but the Unix namespace rules do not allow the
        whenever possible but the Unix namespace rules do not allow the

+ 6 - 14
libc/sysdeps/linux/v850/bits/kernel_stat.h

@@ -19,12 +19,9 @@ struct kernel_stat
   __kernel_off_t	st_size;
   __kernel_off_t	st_size;
   unsigned long		st_blksize;
   unsigned long		st_blksize;
   unsigned long		st_blocks;
   unsigned long		st_blocks;
-  unsigned long		st_atime;
+  struct timespec	st_atim;
-  unsigned long		__unused1;
+  struct timespec	st_mtim;
-  unsigned long		st_mtime;
+  struct timespec	st_ctim;
-  unsigned long		__unused2;
-  unsigned long		st_ctime;
-  unsigned long		__unused3;
   unsigned long		__unused4;
   unsigned long		__unused4;
   unsigned long		__unused5;
   unsigned long		__unused5;
 };
 };
@@ -53,14 +50,9 @@ struct kernel_stat64
   unsigned long		__unused4; /* future possible st_blocks high bits */
   unsigned long		__unused4; /* future possible st_blocks high bits */
   unsigned long		st_blocks; /* Number 512-byte blocks allocated. */
   unsigned long		st_blocks; /* Number 512-byte blocks allocated. */
 
 
-  unsigned long		st_atime;
+  struct timespec	st_atim;
-  unsigned long		__unused5;
+  struct timespec	st_mtim;
-
+  struct timespec	st_ctim;
-  unsigned long		st_mtime;
-  unsigned long		__unused6;
-
-  unsigned long		st_ctime;
-  unsigned long		__unused7; /* high 32 bits of ctime someday */
 };
 };
 
 
 #endif	/*  _BITS_STAT_STRUCT_H */
 #endif	/*  _BITS_STAT_STRUCT_H */

+ 6 - 12
libc/sysdeps/linux/vax/bits/kernel_stat.h

@@ -22,12 +22,9 @@ struct kernel_stat {
 	unsigned long  st_size;
 	unsigned long  st_size;
 	unsigned long  st_blksize;
 	unsigned long  st_blksize;
 	unsigned long  st_blocks;
 	unsigned long  st_blocks;
-	unsigned long  st_atime;
+	struct timespec st_atim;
-	unsigned long  __unused1;
+	struct timespec st_mtim;
-	unsigned long  st_mtime;
+	struct timespec st_ctim;
-	unsigned long  __unused2;
-	unsigned long  st_ctime;
-	unsigned long  __unused3;
 	unsigned long  __unused4;
 	unsigned long  __unused4;
 	unsigned long  __unused5;
 	unsigned long  __unused5;
 };
 };
@@ -47,12 +44,9 @@ struct kernel_stat64 {
 	unsigned long	st_blksize;
 	unsigned long	st_blksize;
 	unsigned long	st_blocks;	/* Number 512-byte blocks allocated. */
 	unsigned long	st_blocks;	/* Number 512-byte blocks allocated. */
 	unsigned long	__pad4;		/* future possible st_blocks high bits */
 	unsigned long	__pad4;		/* future possible st_blocks high bits */
-	unsigned long	st_atime;
+	struct timespec	st_atim;
-	unsigned long	__pad5;
+	struct timespec	st_mtim;
-	unsigned long	st_mtime;
+	struct timespec	st_ctim;
-	unsigned long	__pad6;
-	unsigned long	st_ctime;
-	unsigned long	__pad7;		/* will be high 32 bits of ctime someday */
 	unsigned long long	st_ino;
 	unsigned long long	st_ino;
 };
 };
 
 

+ 3 - 23
libc/sysdeps/linux/x86_64/bits/kernel_stat.h

@@ -8,8 +8,6 @@
 #error bits/kernel_stat.h is for internal uClibc use only!
 #error bits/kernel_stat.h is for internal uClibc use only!
 #endif
 #endif
 
 
-#define STAT_HAVE_NSEC 1
-
 struct kernel_stat {
 struct kernel_stat {
 	unsigned long  st_dev;
 	unsigned long  st_dev;
 	unsigned long  st_ino;
 	unsigned long  st_ino;
@@ -24,30 +22,12 @@ struct kernel_stat {
 	long           st_blksize;
 	long           st_blksize;
 	long           st_blocks;    /* Number 512-byte blocks allocated. */
 	long           st_blocks;    /* Number 512-byte blocks allocated. */
 
 
-	unsigned long  st_atime;
+	struct timespec st_atim;
-	unsigned long  st_atime_nsec;
+	struct timespec st_mtim;
-	unsigned long  st_mtime;
+	struct timespec st_ctim;
-	unsigned long  st_mtime_nsec;
-	unsigned long  st_ctime;
-	unsigned long  st_ctime_nsec;
 	long           __unused[3];
 	long           __unused[3];
 };
 };
 
 
-/* For 32bit emulation */
-struct __old_kernel_stat {
-	unsigned short st_dev;
-	unsigned short st_ino;
-	unsigned short st_mode;
-	unsigned short st_nlink;
-	unsigned short st_uid;
-	unsigned short st_gid;
-	unsigned short st_rdev;
-	unsigned int   st_size;
-	unsigned int   st_atime;
-	unsigned int   st_mtime;
-	unsigned int   st_ctime;
-};
-
 /* x86-64 stat64 is same as stat */
 /* x86-64 stat64 is same as stat */
 #define kernel_stat64 kernel_stat
 #define kernel_stat64 kernel_stat
 
 

+ 2 - 2
libc/sysdeps/linux/x86_64/bits/stat.h

@@ -78,7 +78,7 @@ struct stat
 #else
 #else
     __blkcnt64_t st_blocks;		/* Number 512-byte blocks allocated. */
     __blkcnt64_t st_blocks;		/* Number 512-byte blocks allocated. */
 #endif
 #endif
-#if 0 /*def __USE_MISC*/
+#ifdef __USE_MISC
     /* Nanosecond resolution timestamps are stored in a format
     /* Nanosecond resolution timestamps are stored in a format
        equivalent to 'struct timespec'.  This is the type used
        equivalent to 'struct timespec'.  This is the type used
        whenever possible but the Unix namespace rules do not allow the
        whenever possible but the Unix namespace rules do not allow the
@@ -139,7 +139,7 @@ struct stat64
 #endif
 #endif
     __blksize_t st_blksize;	/* Optimal block size for I/O.  */
     __blksize_t st_blksize;	/* Optimal block size for I/O.  */
     __blkcnt64_t st_blocks;	/* Nr. 512-byte blocks allocated.  */
     __blkcnt64_t st_blocks;	/* Nr. 512-byte blocks allocated.  */
-#if 0 /*def __USE_MISC*/
+#ifdef __USE_MISC
     /* Nanosecond resolution timestamps are stored in a format
     /* Nanosecond resolution timestamps are stored in a format
        equivalent to 'struct timespec'.  This is the type used
        equivalent to 'struct timespec'.  This is the type used
        whenever possible but the Unix namespace rules do not allow the
        whenever possible but the Unix namespace rules do not allow the

+ 6 - 14
libc/sysdeps/linux/xtensa/bits/kernel_stat.h

@@ -9,8 +9,6 @@
  * struct kernel_stat should look like...  It turns out each arch has a
  * struct kernel_stat should look like...  It turns out each arch has a
  * different opinion on the subject... */
  * different opinion on the subject... */
 
 
-#define STAT_HAVE_NSEC 1
-
 struct kernel_stat {
 struct kernel_stat {
 	unsigned long	st_dev;
 	unsigned long	st_dev;
 	unsigned long	st_ino;
 	unsigned long	st_ino;
@@ -22,12 +20,9 @@ struct kernel_stat {
 	long		st_size;
 	long		st_size;
 	unsigned long	st_blksize;
 	unsigned long	st_blksize;
 	unsigned long	st_blocks;
 	unsigned long	st_blocks;
-	unsigned long	st_atime;
+	struct timespec	st_atim;
-	unsigned long	st_atime_nsec;
+	struct timespec	st_mtim;
-	unsigned long	st_mtime;
+	struct timespec	st_ctim;
-	unsigned long	st_mtime_nsec;
-	unsigned long	st_ctime;
-	unsigned long	st_ctime_nsec;
 	unsigned long	__unused4;
 	unsigned long	__unused4;
 	unsigned long	__unused5;
 	unsigned long	__unused5;
 };
 };
@@ -44,12 +39,9 @@ struct kernel_stat64 {
 	unsigned long st_blksize;	/* Optimal block size for I/O. */
 	unsigned long st_blksize;	/* Optimal block size for I/O. */
 	unsigned long __unused2;
 	unsigned long __unused2;
 	unsigned long long st_blocks;	/* Number 512-byte blocks allocated. */
 	unsigned long long st_blocks;	/* Number 512-byte blocks allocated. */
-	unsigned long st_atime;		/* Time of last access. */
+	struct timespec st_atim;	/* Time of last access. */
-	unsigned long st_atime_nsec;
+	struct timespec st_mtim;	/* Time of last modification. */
-	unsigned long st_mtime;		/* Time of last modification. */
+	struct timespec st_ctim;	/* Time of last status change. */
-	unsigned long st_mtime_nsec;
-	unsigned long st_ctime;		/* Time of last status change. */
-	unsigned long st_ctime_nsec;
 	unsigned long __unused4;
 	unsigned long __unused4;
 	unsigned long __unused5;
 	unsigned long __unused5;
 };
 };

+ 2 - 2
libc/sysdeps/linux/xtensa/bits/stat.h

@@ -55,7 +55,7 @@ struct stat
     unsigned long __pad2;
     unsigned long __pad2;
     __blkcnt64_t st_blocks;		/* Number 512-byte blocks allocated. */
     __blkcnt64_t st_blocks;		/* Number 512-byte blocks allocated. */
 #endif
 #endif
-#if 0 /*def __USE_MISC*/
+#ifdef __USE_MISC
     /* Nanosecond resolution timestamps are stored in a format
     /* Nanosecond resolution timestamps are stored in a format
        equivalent to 'struct timespec'.  This is the type used
        equivalent to 'struct timespec'.  This is the type used
        whenever possible but the Unix namespace rules do not allow the
        whenever possible but the Unix namespace rules do not allow the
@@ -95,7 +95,7 @@ struct stat64
 
 
     unsigned long __pad2;
     unsigned long __pad2;
     __blkcnt64_t st_blocks;		/* Number 512-byte blocks allocated. */
     __blkcnt64_t st_blocks;		/* Number 512-byte blocks allocated. */
-#if 0 /*def __USE_MISC*/
+#ifdef __USE_MISC
     /* Nanosecond resolution timestamps are stored in a format
     /* Nanosecond resolution timestamps are stored in a format
        equivalent to 'struct timespec'.  This is the type used
        equivalent to 'struct timespec'.  This is the type used
        whenever possible but the Unix namespace rules do not allow the
        whenever possible but the Unix namespace rules do not allow the