浏览代码

Finish off the bits/kernel_stat.h cleanup for proper
__USE_FILE_OFFSET64 handling.
-Erik

Eric Andersen 23 年之前
父节点
当前提交
ee3323be35

+ 17 - 0
libc/sysdeps/linux/alpha/bits/kernel_stat.h

@@ -21,6 +21,23 @@ struct stat {
 	unsigned int	st_flags;
 	unsigned int	st_gen;
 };
+struct stat64 {
+	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;
+	long		st_size;
+	unsigned long	st_atime;
+	unsigned long	st_mtime;
+	unsigned long	st_ctime;
+	unsigned int	st_blksize;
+	int		st_blocks;
+	unsigned int	st_flags;
+	unsigned int	st_gen;
+};
 
 
 #endif	/*  _BITS_STAT_STRUCT_H */

+ 28 - 1
libc/sysdeps/linux/arm/bits/kernel_stat.h

@@ -4,6 +4,8 @@
 /* This file provides whatever this particular arch's kernel thinks 
  * struct stat should look like...  It turns out each arch has a 
  * different opinion on the subject... */
+
+#ifndef __USE_FILE_OFFSET64
 struct stat {
 	unsigned short st_dev;
 	unsigned short __pad1;
@@ -26,6 +28,32 @@ struct stat {
 	unsigned long  __unused4;
 	unsigned long  __unused5;
 };
+#else
+struct stat {
+	unsigned short	st_dev;
+	unsigned char	__pad0[10];
+#define STAT64_HAS_BROKEN_ST_INO	1
+	unsigned long	__st_ino;
+	unsigned int	st_mode;
+	unsigned int	st_nlink;
+	unsigned long	st_uid;
+	unsigned long	st_gid;
+	unsigned short	st_rdev;
+	unsigned char	__pad3[10];
+	long long	st_size;
+	unsigned long	st_blksize;
+	unsigned long	st_blocks;	/* Number 512-byte blocks allocated. */
+	unsigned long	__pad4;		/* future possible st_blocks high bits */
+	unsigned long	st_atime;
+	unsigned long	__pad5;
+	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;
+};
+#endif
+
 #ifdef __USE_LARGEFILE64
 struct stat64 {
 	unsigned short	st_dev;
@@ -52,6 +80,5 @@ struct stat64 {
 };
 #endif
 
-
 #endif	/*  _BITS_STAT_STRUCT_H */
 

+ 27 - 1
libc/sysdeps/linux/common/bits/kernel_stat.h

@@ -6,6 +6,7 @@
  * different opinion on the subject... */
 #warning please verify struct stat for your architecture matches struct stat for x86...
 
+#ifndef __USE_FILE_OFFSET64
 struct stat {
 	unsigned short st_dev;
 	unsigned short __pad1;
@@ -28,6 +29,32 @@ struct stat {
 	unsigned long  __unused4;
 	unsigned long  __unused5;
 };
+#else
+struct stat {
+	unsigned short	st_dev;
+	unsigned char	__pad0[10];
+#define STAT64_HAS_BROKEN_ST_INO	1
+	unsigned long	__st_ino;
+	unsigned int	st_mode;
+	unsigned int	st_nlink;
+	unsigned long	st_uid;
+	unsigned long	st_gid;
+	unsigned short	st_rdev;
+	unsigned char	__pad3[10];
+	long long	st_size;
+	unsigned long	st_blksize;
+	unsigned long	st_blocks;	/* Number 512-byte blocks allocated. */
+	unsigned long	__pad4;		/* future possible st_blocks high bits */
+	unsigned long	st_atime;
+	unsigned long	__pad5;
+	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;
+};
+#endif
+
 #ifdef __USE_LARGEFILE64
 struct stat64 {
 	unsigned short	st_dev;
@@ -54,6 +81,5 @@ struct stat64 {
 };
 #endif
 
-
 #endif	/*  _BITS_STAT_STRUCT_H */
 

+ 30 - 0
libc/sysdeps/linux/m68k/bits/kernel_stat.h

@@ -4,6 +4,8 @@
 /* This file provides whatever this particular arch's kernel thinks 
  * struct stat should look like...  It turns out each arch has a 
  * different opinion on the subject... */
+
+#ifndef __USE_FILE_OFFSET64
 struct stat {
 	unsigned short st_dev;
 	unsigned short __pad1;
@@ -26,6 +28,34 @@ struct stat {
 	unsigned long  __unused4;
 	unsigned long  __unused5;
 };
+#else
+struct stat {
+	unsigned char	__pad0[6];
+	unsigned short	st_dev;
+	unsigned char	__pad1[2];
+#define STAT64_HAS_BROKEN_ST_INO	1
+	unsigned long	__st_ino;
+	unsigned int	st_mode;
+	unsigned int	st_nlink;
+	unsigned long	st_uid;
+	unsigned long	st_gid;
+	unsigned char	__pad2[6];
+	unsigned short	st_rdev;
+	unsigned char	__pad3[2];
+	long long	st_size;
+	unsigned long	st_blksize;
+	unsigned long	__pad4;		/* future possible st_blocks high bits */
+	unsigned long	st_blocks;	/* Number 512-byte blocks allocated. */
+	unsigned long	st_atime;
+	unsigned long	__pad5;
+	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;
+};
+#endif
+
 #ifdef __USE_LARGEFILE64
 struct stat64 {
 	unsigned char	__pad0[6];

+ 48 - 0
libc/sysdeps/linux/mips/bits/kernel_stat.h

@@ -26,7 +26,31 @@ struct stat {
 	unsigned long	st_pad2;
 	long long	st_blocks;
 };
+struct stat64 {
+	unsigned long	st_dev;
+	unsigned long	st_pad0[3];	/* Reserved for st_dev expansion  */
+	unsigned long long	st_ino;
+	unsigned int	st_mode;
+	int		st_nlink;
+	int		st_uid;
+	int		st_gid;
+	unsigned long	st_rdev;
+	unsigned long	st_pad1[3];	/* Reserved for st_rdev expansion  */
+	long long	st_size;
+	long		st_atime;
+	unsigned long	reserved0;	/* Reserved for st_atime expansion  */
+	long		st_mtime;
+	unsigned long	reserved1;	/* Reserved for st_mtime expansion  */
+	long		st_ctime;
+	unsigned long	reserved2;	/* Reserved for st_ctime expansion  */
+	unsigned long	st_blksize;
+	unsigned long	st_pad2;
+	long long	st_blocks;
+};
+
 #else
+
+#ifndef __USE_FILE_OFFSET64
 struct stat {
 	unsigned int	st_dev;
 	long		st_pad1[3];		/* Reserved for network id */
@@ -49,6 +73,30 @@ struct stat {
 	long		st_blocks;
 	long		st_pad4[14];
 };
+#else
+struct stat {
+	unsigned long	st_dev;
+	unsigned long	st_pad0[3];	/* Reserved for st_dev expansion  */
+	unsigned long long	st_ino;
+	unsigned int	st_mode;
+	int		st_nlink;
+	int		st_uid;
+	int		st_gid;
+	unsigned long	st_rdev;
+	unsigned long	st_pad1[3];	/* Reserved for st_rdev expansion  */
+	long long	st_size;
+	long		st_atime;
+	unsigned long	reserved0;	/* Reserved for st_atime expansion  */
+	long		st_mtime;
+	unsigned long	reserved1;	/* Reserved for st_mtime expansion  */
+	long		st_ctime;
+	unsigned long	reserved2;	/* Reserved for st_ctime expansion  */
+	unsigned long	st_blksize;
+	unsigned long	st_pad2;
+	long long	st_blocks;
+};
+#endif
+
 #ifdef __USE_LARGEFILE64
 struct stat64 {
 	unsigned long	st_dev;

+ 46 - 0
libc/sysdeps/linux/powerpc/bits/kernel_stat.h

@@ -26,7 +26,29 @@ struct stat {
 	unsigned long int __unused4;
 	unsigned long int __unused5;
 };
+struct stat64 {
+	unsigned long long st_dev; 	/* Device.  */
+	unsigned long long st_ino;	/* File serial number.  */
+	unsigned int st_mode;		/* File mode.  */
+	unsigned int st_nlink;		/* Link count.  */
+	unsigned int st_uid;		/* User ID of the file's owner.  */
+	unsigned int st_gid;		/* Group ID of the file's group. */
+	unsigned long long st_rdev; 	/* Device number, if device.  */
+	unsigned short int __pad2;
+	long long st_size;		/* Size of file, in bytes.  */
+	long st_blksize;		/* Optimal block size for I/O.  */
+	long long st_blocks;		/* Number 512-byte blocks allocated. */
+	long st_atime;			/* Time of last access.  */
+	unsigned long int __unused1;
+	long st_mtime;			/* Time of last modification.  */
+	unsigned long int __unused2;
+	long st_ctime;			/* Time of last status change.  */
+	unsigned long int __unused3;
+	unsigned long int __unused4;
+	unsigned long int __unused5;
+};
 #else
+#ifndef __USE_FILE_OFFSET64
 struct stat {
 	unsigned int	st_dev;
 	unsigned int	st_ino;
@@ -47,6 +69,30 @@ struct stat {
 	unsigned long  	__unused4;
 	unsigned long  	__unused5;
 };
+#else
+struct stat {
+	unsigned long long st_dev; 	/* Device.  */
+	unsigned long long st_ino;	/* File serial number.  */
+	unsigned int st_mode;		/* File mode.  */
+	unsigned int st_nlink;		/* Link count.  */
+	unsigned int st_uid;		/* User ID of the file's owner.  */
+	unsigned int st_gid;		/* Group ID of the file's group. */
+	unsigned long long st_rdev; 	/* Device number, if device.  */
+	unsigned short int __pad2;
+	long long st_size;		/* Size of file, in bytes.  */
+	long st_blksize;		/* Optimal block size for I/O.  */
+	long long st_blocks;		/* Number 512-byte blocks allocated. */
+	long st_atime;			/* Time of last access.  */
+	unsigned long int __unused1;
+	long st_mtime;			/* Time of last modification.  */
+	unsigned long int __unused2;
+	long st_ctime;			/* Time of last status change.  */
+	unsigned long int __unused3;
+	unsigned long int __unused4;
+	unsigned long int __unused5;
+};
+#endif
+
 #ifdef __USE_LARGEFILE64
 struct stat64 {
 	unsigned long long st_dev; 	/* Device.  */

+ 55 - 0
libc/sysdeps/linux/sh/bits/kernel_stat.h

@@ -6,6 +6,7 @@
  * different opinion on the subject... */
 #include <endian.h>
 
+#ifndef __USE_FILE_OFFSET64
 struct stat {
 	unsigned short st_dev;
 	unsigned short __pad1;
@@ -28,6 +29,60 @@ struct stat {
 	unsigned long  __unused4;
 	unsigned long  __unused5;
 };
+#else
+struct stat {
+#if defined(__BIG_ENDIAN__)
+	unsigned char   __pad0b[6];
+	unsigned short	st_dev;
+#elif defined(__LITTLE_ENDIAN__)
+	unsigned short	st_dev;
+	unsigned char	__pad0b[6];
+#else
+#error Must know endian to build stat64 structure!
+#endif
+	unsigned char	__pad0[4];
+
+	unsigned long	st_ino;
+	unsigned int	st_mode;
+	unsigned int	st_nlink;
+
+	unsigned long	st_uid;
+	unsigned long	st_gid;
+
+#if defined(__BIG_ENDIAN__)
+	unsigned char	__pad3b[6];
+	unsigned short	st_rdev;
+#else /* Must be little */
+	unsigned short	st_rdev;
+	unsigned char	__pad3b[6];
+#endif
+	unsigned char	__pad3[4];
+
+	long long	st_size;
+	unsigned long	st_blksize;
+
+#if defined(__BIG_ENDIAN__)
+	unsigned long	__pad4;		/* Future possible st_blocks hi bits */
+	unsigned long	st_blocks;	/* Number 512-byte blocks allocated. */
+#else /* Must be little */
+	unsigned long	st_blocks;	/* Number 512-byte blocks allocated. */
+	unsigned long	__pad4;		/* Future possible st_blocks hi bits */
+#endif
+
+	unsigned long	st_atime;
+	unsigned long	__pad5;
+
+	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	__unused2;
+};
+#endif
+
 #ifdef __USE_LARGEFILE64
 struct stat64 {
 #if defined(__BIG_ENDIAN__)

+ 53 - 0
libc/sysdeps/linux/sparc/bits/kernel_stat.h

@@ -29,7 +29,33 @@ struct stat {
 	unsigned int	__unused4;
 	unsigned int	__unused5;
 };
+struct stat64 {
+	unsigned char	__pad0[6];
+	unsigned short	st_dev;
+	unsigned long long	st_ino;
+	unsigned int	st_mode;
+	unsigned int	st_nlink;
+	unsigned int	st_uid;
+	unsigned int	st_gid;
+	unsigned char	__pad2[6];
+	unsigned short	st_rdev;
+	unsigned char	__pad3[8];
+	long long	st_size;
+	unsigned int	st_blksize;
+	unsigned char	__pad4[8];
+	unsigned int	st_blocks;
+	unsigned int	st_atime;
+	unsigned int	__unused1;
+	unsigned int	st_mtime;
+	unsigned int	__unused2;
+	unsigned int	st_ctime;
+	unsigned int	__unused3;
+	unsigned int	__unused4;
+	unsigned int	__unused5;
+};
+
 #else
+#ifndef __USE_FILE_OFFSET64
 struct stat {
 	unsigned short	st_dev;
 	unsigned long	st_ino;
@@ -49,6 +75,33 @@ struct stat {
 	long		st_blocks;
 	unsigned long	__unused4[2];
 };
+#else
+struct stat {
+	unsigned char	__pad0[6];
+	unsigned short	st_dev;
+	unsigned long long	st_ino;
+	unsigned int	st_mode;
+	unsigned int	st_nlink;
+	unsigned int	st_uid;
+	unsigned int	st_gid;
+	unsigned char	__pad2[6];
+	unsigned short	st_rdev;
+	unsigned char	__pad3[8];
+	long long	st_size;
+	unsigned int	st_blksize;
+	unsigned char	__pad4[8];
+	unsigned int	st_blocks;
+	unsigned int	st_atime;
+	unsigned int	__unused1;
+	unsigned int	st_mtime;
+	unsigned int	__unused2;
+	unsigned int	st_ctime;
+	unsigned int	__unused3;
+	unsigned int	__unused4;
+	unsigned int	__unused5;
+};
+#endif
+
 #ifdef __USE_LARGEFILE64
 struct stat64 {
 	unsigned char	__pad0[6];