summaryrefslogtreecommitdiff
path: root/libc/sysdeps
diff options
context:
space:
mode:
authorEric Andersen <andersen@codepoet.org>2003-01-24 11:44:14 +0000
committerEric Andersen <andersen@codepoet.org>2003-01-24 11:44:14 +0000
commit85800279bcad0b3495ccc22374f42cd04675f9e4 (patch)
tree30f6754fb734191d6cd7d3fad292a94c02430418 /libc/sysdeps
parent8c29bb071a5d7f6cf8edb26b93bd9e48d4ad3df1 (diff)
Ok, people are probably going to hate me for this... This commit changes the
type of 'struct stat' and 'struct stat64' so they use consistant types. This change is the result of a bug I found while trying to use GNU tar. The problem was caused by our using kernel types within struct stat and trying to directly compare these values with standard types. Trying an 'if (a < b)' when 'a' is an 'unsigned long' and 'b' is an 'int' leads to very different results then when comparing entities of the same type (i.e. time_t values).... Grumble. Nasty stuff, but I'm glad I got this out of the way now. As a result of this fix, uClibc 0.9.17 will not be binary compatible with earlier releases. I have always warned people this can and will happen. -Erik
Diffstat (limited to 'libc/sysdeps')
-rw-r--r--libc/sysdeps/linux/alpha/bits/kernel_stat.h6
-rw-r--r--libc/sysdeps/linux/arm/bits/kernel_stat.h34
-rw-r--r--libc/sysdeps/linux/common/bits/kernel_stat.h36
-rw-r--r--libc/sysdeps/linux/common/bits/stat.h72
-rw-r--r--libc/sysdeps/linux/common/syscalls.c114
-rw-r--r--libc/sysdeps/linux/common/xstatconv.c103
-rw-r--r--libc/sysdeps/linux/cris/bits/kernel_stat.h6
-rw-r--r--libc/sysdeps/linux/h8300/bits/kernel_stat.h36
-rw-r--r--libc/sysdeps/linux/i386/bits/kernel_stat.h31
-rw-r--r--libc/sysdeps/linux/m68k/bits/kernel_stat.h36
-rw-r--r--libc/sysdeps/linux/mips/bits/kernel_stat.h79
-rw-r--r--libc/sysdeps/linux/powerpc/bits/kernel_stat.h74
-rw-r--r--libc/sysdeps/linux/sh/bits/kernel_stat.h63
-rw-r--r--libc/sysdeps/linux/sparc/bits/kernel_stat.h80
-rw-r--r--libc/sysdeps/linux/v850/bits/kernel_stat.h44
15 files changed, 310 insertions, 504 deletions
diff --git a/libc/sysdeps/linux/alpha/bits/kernel_stat.h b/libc/sysdeps/linux/alpha/bits/kernel_stat.h
index cca4e71fa..0e1f2f7bd 100644
--- a/libc/sysdeps/linux/alpha/bits/kernel_stat.h
+++ b/libc/sysdeps/linux/alpha/bits/kernel_stat.h
@@ -2,9 +2,9 @@
#define _BITS_STAT_STRUCT_H
/* This file provides whatever this particular arch's kernel thinks
- * struct 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... */
-struct stat {
+struct kernel_stat {
unsigned int st_dev;
unsigned int st_ino;
unsigned int st_mode;
@@ -21,7 +21,7 @@ struct stat {
unsigned int st_flags;
unsigned int st_gen;
};
-struct stat64 {
+struct kernel_stat64 {
unsigned int st_dev;
unsigned int st_ino;
unsigned int st_mode;
diff --git a/libc/sysdeps/linux/arm/bits/kernel_stat.h b/libc/sysdeps/linux/arm/bits/kernel_stat.h
index 567b4a4d7..cb1d36cda 100644
--- a/libc/sysdeps/linux/arm/bits/kernel_stat.h
+++ b/libc/sysdeps/linux/arm/bits/kernel_stat.h
@@ -2,11 +2,10 @@
#define _BITS_STAT_STRUCT_H
/* This file provides whatever this particular arch's kernel thinks
- * struct 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... */
-#ifndef __USE_FILE_OFFSET64
-struct stat {
+struct kernel_stat {
unsigned short st_dev;
unsigned short __pad1;
unsigned long st_ino;
@@ -28,34 +27,8 @@ 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 {
+struct kernel_stat64 {
unsigned short st_dev;
unsigned char __pad0[10];
#define STAT64_HAS_BROKEN_ST_INO 1
@@ -78,7 +51,6 @@ struct stat64 {
unsigned long __pad7; /* will be high 32 bits of ctime someday */
unsigned long long st_ino;
};
-#endif
#endif /* _BITS_STAT_STRUCT_H */
diff --git a/libc/sysdeps/linux/common/bits/kernel_stat.h b/libc/sysdeps/linux/common/bits/kernel_stat.h
index b338e3d5c..04c984757 100644
--- a/libc/sysdeps/linux/common/bits/kernel_stat.h
+++ b/libc/sysdeps/linux/common/bits/kernel_stat.h
@@ -2,12 +2,11 @@
#define _BITS_STAT_STRUCT_H
/* This file provides whatever this particular arch's kernel thinks
- * struct 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... */
-#warning please verify struct stat for your architecture matches struct stat for x86...
+#warning "Please verify struct kernel_stat for your architecture actually matches struct kernel_stat for x86 If it doesn't, then you will need to add a proper kernel_stat.h for your architecture..."
-#ifndef __USE_FILE_OFFSET64
-struct stat {
+struct kernel_stat {
unsigned short st_dev;
unsigned short __pad1;
unsigned long st_ino;
@@ -29,34 +28,8 @@ 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 {
+struct kernel_stat64 {
unsigned short st_dev;
unsigned char __pad0[10];
#define STAT64_HAS_BROKEN_ST_INO 1
@@ -79,7 +52,6 @@ struct stat64 {
unsigned long __pad7; /* will be high 32 bits of ctime someday */
unsigned long long st_ino;
};
-#endif
#endif /* _BITS_STAT_STRUCT_H */
diff --git a/libc/sysdeps/linux/common/bits/stat.h b/libc/sysdeps/linux/common/bits/stat.h
index 942accda1..3ecec4a47 100644
--- a/libc/sysdeps/linux/common/bits/stat.h
+++ b/libc/sysdeps/linux/common/bits/stat.h
@@ -35,10 +35,74 @@
#define _MKNOD_VER_SVR4 2
#define _MKNOD_VER _MKNOD_VER_LINUX /* The bits defined below. */
-/* Pull in whatever this particular arch's kernel thinks that struct stat
- * should look like. It turns out that each arch has a different opinion
- * on the subject, and different kernel revs use different names... */
-#include <bits/kernel_stat.h>
+struct stat
+{
+ __dev_t st_dev; /* Device. */
+ unsigned short int __pad1;
+#ifndef __USE_FILE_OFFSET64
+ __ino_t st_ino; /* File serial number. */
+#else
+ __ino_t __st_ino; /* 32bit file serial number. */
+#endif
+ __mode_t st_mode; /* File mode. */
+ __nlink_t st_nlink; /* Link count. */
+ __uid_t st_uid; /* User ID of the file's owner. */
+ __gid_t st_gid; /* Group ID of the file's group.*/
+ __dev_t st_rdev; /* Device number, if device. */
+ unsigned short int __pad2;
+#ifndef __USE_FILE_OFFSET64
+ __off_t st_size; /* Size of file, in bytes. */
+#else
+ __off64_t st_size; /* Size of file, in bytes. */
+#endif
+ __blksize_t st_blksize; /* Optimal block size for I/O. */
+
+#ifndef __USE_FILE_OFFSET64
+ __blkcnt_t st_blocks; /* Number 512-byte blocks allocated. */
+#else
+ __blkcnt64_t st_blocks; /* Number 512-byte blocks allocated. */
+#endif
+ __time_t st_atime; /* Time of last access. */
+ unsigned long int __unused1;
+ __time_t st_mtime; /* Time of last modification. */
+ unsigned long int __unused2;
+ __time_t st_ctime; /* Time of last status change. */
+ unsigned long int __unused3;
+#ifndef __USE_FILE_OFFSET64
+ unsigned long int __unused4;
+ unsigned long int __unused5;
+#else
+ __ino64_t st_ino; /* File serial number. */
+#endif
+};
+
+#ifdef __USE_LARGEFILE64
+struct stat64
+{
+ __dev_t st_dev; /* Device. */
+ unsigned int __pad1;
+
+ __ino_t __st_ino; /* 32bit file serial number. */
+ __mode_t st_mode; /* File mode. */
+ __nlink_t st_nlink; /* Link count. */
+ __uid_t st_uid; /* User ID of the file's owner. */
+ __gid_t st_gid; /* Group ID of the file's group.*/
+ __dev_t st_rdev; /* Device number, if device. */
+ unsigned int __pad2;
+ __off64_t st_size; /* Size of file, in bytes. */
+ __blksize_t st_blksize; /* Optimal block size for I/O. */
+
+ __blkcnt64_t st_blocks; /* Number 512-byte blocks allocated. */
+ __time_t st_atime; /* Time of last access. */
+ unsigned long int __unused1;
+ __time_t st_mtime; /* Time of last modification. */
+ unsigned long int __unused2;
+ __time_t st_ctime; /* Time of last status change. */
+ unsigned long int __unused3;
+ __ino64_t st_ino; /* File serial number. */
+};
+#endif
+
/* Tell code we have these members. */
#define _STATBUF_ST_BLKSIZE
diff --git a/libc/sysdeps/linux/common/syscalls.c b/libc/sysdeps/linux/common/syscalls.c
index 6090d37db..867635856 100644
--- a/libc/sysdeps/linux/common/syscalls.c
+++ b/libc/sysdeps/linux/common/syscalls.c
@@ -156,9 +156,17 @@ time_t time (time_t *t)
#endif
//#define __NR_mknod 14
-#ifdef L_mknod
+#ifdef L___syscall_mknod
+#define __NR___syscall_mknod __NR_mknod
#include <sys/stat.h>
-_syscall3(int, mknod, const char *, path, mode_t, mode, dev_t, dev);
+_syscall3(int, __syscall_mknod, const char *, path, __kernel_mode_t, mode, __kernel_dev_t, dev);
+int mknod(const char *path, mode_t mode, dev_t dev)
+{
+ __kernel_dev_t k_dev;
+ /* We must convert the dev_t value to a __kernel_dev_t */
+ k_dev = ((major(dev) & 0xff) << 8) | (minor(dev) & 0xff);
+ return __syscall_mknod(path, mode, k_dev);
+}
#endif
//#define __NR_chmod 15
@@ -958,30 +966,69 @@ _syscall2(int, getitimer, __itimer_which_t, which, struct itimerval *, value);
#endif
//#define __NR_stat 106
-#ifdef L_stat
+#ifdef L___syscall_stat
+#define __NR___syscall_stat __NR_stat
#include <unistd.h>
#include <sys/stat.h>
-_syscall2(int, stat, const char *, file_name, struct stat *, buf);
+#include <bits/kernel_stat.h>
+#include "xstatconv.c"
+_syscall2(int, __syscall_stat, const char *, file_name, struct kernel_stat *, buf);
+int stat(const char * file_name, struct stat * buf)
+{
+ int result;
+ struct kernel_stat kbuf;
+ result = __syscall_stat(file_name, &kbuf);
+ if (result == 0) {
+ __xstat_conv(&kbuf, buf);
+ }
+ return result;
+}
#if ! defined __NR_stat64 && defined __UCLIBC_HAS_LFS__
weak_alias(stat, stat64);
#endif
#endif
//#define __NR_lstat 107
-#ifdef L_lstat
+#ifdef L___syscall_lstat
+#define __NR___syscall_lstat __NR_lstat
#include <unistd.h>
#include <sys/stat.h>
-_syscall2(int, lstat, const char *, file_name, struct stat *, buf);
+#include <bits/kernel_stat.h>
+#include "xstatconv.c"
+_syscall2(int, __syscall_lstat, const char *, file_name, struct kernel_stat *, buf);
+int lstat(const char * file_name, struct stat * buf)
+{
+ int result;
+ struct kernel_stat kbuf;
+ result = __syscall_lstat(file_name, &kbuf);
+ if (result == 0) {
+ __xstat_conv(&kbuf, buf);
+ }
+ return result;
+}
#if ! defined __NR_lstat64 && defined __UCLIBC_HAS_LFS__
weak_alias(lstat, lstat64);
#endif
#endif
//#define __NR_fstat 108
-#ifdef L_fstat
+#ifdef L___syscall_fstat
+#define __NR___syscall_fstat __NR_fstat
#include <unistd.h>
#include <sys/stat.h>
-_syscall2(int, fstat, int, filedes, struct stat *, buf);
+#include <bits/kernel_stat.h>
+#include "xstatconv.c"
+_syscall2(int, __syscall_fstat, int, fd, struct kernel_stat *, buf);
+int fstat(int fd, struct stat * buf)
+{
+ int result;
+ struct kernel_stat kbuf;
+ result = __syscall_fstat(fd, &kbuf);
+ if (result == 0) {
+ __xstat_conv(&kbuf, buf);
+ }
+ return result;
+}
#if ! defined __NR_fstat64 && defined __UCLIBC_HAS_LFS__
weak_alias(fstat, fstat64);
#endif
@@ -1623,29 +1670,68 @@ int getrlimit (__rlimit_resource_t resource, struct rlimit *rlimits)
//#define __NR_stat64 195
-#ifdef L_stat64
+#ifdef L___syscall_stat64
#if defined __NR_stat64 && defined __UCLIBC_HAS_LFS__
+#define __NR___syscall_stat64 __NR_stat64
#include <unistd.h>
#include <sys/stat.h>
-_syscall2(int, stat64, const char *, file_name, struct stat64 *, buf);
+#include <bits/kernel_stat.h>
+#include "xstatconv.c"
+_syscall2(int, __syscall_stat64, const char *, file_name, struct kernel_stat64 *, buf);
+int stat64(const char * file_name, struct stat64 * buf)
+{
+ int result;
+ struct kernel_stat64 kbuf;
+ result = __syscall_stat64(file_name, &kbuf);
+ if (result == 0) {
+ __xstat64_conv(&kbuf, buf);
+ }
+ return result;
+}
#endif /* __UCLIBC_HAS_LFS__ */
#endif
//#define __NR_lstat64 196
-#ifdef L_lstat64
+#ifdef L___syscall_lstat64
#if defined __NR_lstat64 && defined __UCLIBC_HAS_LFS__
+#define __NR___syscall_lstat64 __NR_lstat64
#include <unistd.h>
#include <sys/stat.h>
-_syscall2(int, lstat64, const char *, file_name, struct stat64 *, buf);
+#include <bits/kernel_stat.h>
+#include "xstatconv.c"
+_syscall2(int, __syscall_lstat64, const char *, file_name, struct kernel_stat64 *, buf);
+int lstat64(const char * file_name, struct stat64 * buf)
+{
+ int result;
+ struct kernel_stat64 kbuf;
+ result = __syscall_lstat64(file_name, &kbuf);
+ if (result == 0) {
+ __xstat64_conv(&kbuf, buf);
+ }
+ return result;
+}
#endif /* __UCLIBC_HAS_LFS__ */
#endif
//#define __NR_fstat64 197
-#ifdef L_fstat64
+#ifdef L___syscall_fstat64
#if defined __NR_fstat64 && defined __UCLIBC_HAS_LFS__
+#define __NR___syscall_fstat64 __NR_fstat64
#include <unistd.h>
#include <sys/stat.h>
-_syscall2(int, fstat64, int, filedes, struct stat64 *, buf);
+#include <bits/kernel_stat.h>
+#include "xstatconv.c"
+_syscall2(int, __syscall_fstat64, int, filedes, struct kernel_stat64 *, buf);
+int fstat64(int fd, struct stat64 * buf)
+{
+ int result;
+ struct kernel_stat64 kbuf;
+ result = __syscall_fstat64(fd, &kbuf);
+ if (result == 0) {
+ __xstat64_conv(&kbuf, buf);
+ }
+ return result;
+}
#endif /* __UCLIBC_HAS_LFS__ */
#endif
diff --git a/libc/sysdeps/linux/common/xstatconv.c b/libc/sysdeps/linux/common/xstatconv.c
new file mode 100644
index 000000000..c8d28d411
--- /dev/null
+++ b/libc/sysdeps/linux/common/xstatconv.c
@@ -0,0 +1,103 @@
+/* Convert between the kernel's `struct stat' format, and libc's.
+ Copyright (C) 1991,1995,1996,1997,2000,2002 Free Software Foundation, Inc.
+ This file is part of the GNU C Library.
+
+ The GNU C Library is free software; you can redistribute it and/or
+ modify it under the terms of the GNU Lesser General Public
+ License as published by the Free Software Foundation; either
+ version 2.1 of the License, or (at your option) any later version.
+
+ The GNU C Library is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ Lesser General Public License for more details.
+
+ You should have received a copy of the GNU Lesser General Public
+ License along with the GNU C Library; if not, write to the Free
+ Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
+ 02111-1307 USA.
+
+ Modified for uClibc by Erik Andersen <andersen@codepoet.org>
+ */
+
+static inline void __xstat_conv(struct kernel_stat *kbuf, struct stat *buf)
+{
+ /* Convert to current kernel version of `struct stat'. */
+ buf->st_dev = kbuf->st_dev;
+#ifdef _HAVE_STAT___PAD1
+ buf->__pad1 = 0;
+#endif
+ buf->st_ino = kbuf->st_ino;
+ buf->st_mode = kbuf->st_mode;
+ buf->st_nlink = kbuf->st_nlink;
+ buf->st_uid = kbuf->st_uid;
+ buf->st_gid = kbuf->st_gid;
+ buf->st_rdev = kbuf->st_rdev;
+#ifdef _HAVE_STAT___PAD2
+ buf->__pad2 = 0;
+#endif
+ buf->st_size = kbuf->st_size;
+ buf->st_blksize = kbuf->st_blksize;
+ buf->st_blocks = kbuf->st_blocks;
+ buf->st_atime = kbuf->st_atime;
+#ifdef _HAVE_STAT___UNUSED1
+ buf->__unused1 = 0;
+#endif
+ buf->st_mtime = kbuf->st_mtime;
+#ifdef _HAVE_STAT___UNUSED2
+ buf->__unused2 = 0;
+#endif
+ buf->st_ctime = kbuf->st_ctime;
+#ifdef _HAVE_STAT___UNUSED3
+ buf->__unused3 = 0;
+#endif
+#ifdef _HAVE_STAT___UNUSED4
+ buf->__unused4 = 0;
+#endif
+#ifdef _HAVE_STAT___UNUSED5
+ buf->__unused5 = 0;
+#endif
+}
+
+static inline void __xstat64_conv(struct kernel_stat64 *kbuf, struct stat64 *buf)
+{
+ /* Convert to current kernel version of `struct stat64'. */
+ buf->st_dev = kbuf->st_dev;
+#ifdef _HAVE_STAT64___PAD1
+ buf->__pad1 = 0;
+#endif
+ buf->st_ino = kbuf->st_ino;
+#ifdef _HAVE_STAT64___ST_INO
+ buf->__st_ino = kbuf->st_ino;
+#endif
+ buf->st_mode = kbuf->st_mode;
+ buf->st_nlink = kbuf->st_nlink;
+ buf->st_uid = kbuf->st_uid;
+ buf->st_gid = kbuf->st_gid;
+ buf->st_rdev = kbuf->st_rdev;
+#ifdef _HAVE_STAT64___PAD2
+ buf->__pad2 = 0;
+#endif
+ buf->st_size = kbuf->st_size;
+ buf->st_blksize = kbuf->st_blksize;
+ buf->st_blocks = kbuf->st_blocks;
+ buf->st_atime = kbuf->st_atime;
+#ifdef _HAVE_STAT64___UNUSED1
+ buf->__unused1 = 0;
+#endif
+ buf->st_mtime = kbuf->st_mtime;
+#ifdef _HAVE_STAT64___UNUSED2
+ buf->__unused2 = 0;
+#endif
+ buf->st_ctime = kbuf->st_ctime;
+#ifdef _HAVE_STAT64___UNUSED3
+ buf->__unused3 = 0;
+#endif
+#ifdef _HAVE_STAT64___UNUSED4
+ buf->__unused4 = 0;
+#endif
+#ifdef _HAVE_STAT64___UNUSED5
+ buf->__unused5 = 0;
+#endif
+}
+
diff --git a/libc/sysdeps/linux/cris/bits/kernel_stat.h b/libc/sysdeps/linux/cris/bits/kernel_stat.h
index 5f0c0f4fe..38f5036a2 100644
--- a/libc/sysdeps/linux/cris/bits/kernel_stat.h
+++ b/libc/sysdeps/linux/cris/bits/kernel_stat.h
@@ -17,7 +17,7 @@ struct __old_kernel_stat {
unsigned long st_ctime;
};
-struct stat {
+struct kernel_stat {
unsigned short st_dev;
unsigned short __pad1;
unsigned long st_ino;
@@ -40,10 +40,10 @@ struct stat {
unsigned long __unused5;
};
-/* This matches struct stat64 in glibc2.1, hence the absolutely
+/* This matches struct kernel_stat64 in glibc2.1, hence the absolutely
* insane amounts of padding around dev_t's.
*/
-struct stat64 {
+struct kernel_stat64 {
unsigned short st_dev;
unsigned char __pad0[10];
diff --git a/libc/sysdeps/linux/h8300/bits/kernel_stat.h b/libc/sysdeps/linux/h8300/bits/kernel_stat.h
index 5ca018eac..9152811ba 100644
--- a/libc/sysdeps/linux/h8300/bits/kernel_stat.h
+++ b/libc/sysdeps/linux/h8300/bits/kernel_stat.h
@@ -2,11 +2,10 @@
#define _BITS_STAT_STRUCT_H
/* This file provides whatever this particular arch's kernel thinks
- * struct 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... */
-#ifndef __USE_FILE_OFFSET64
-struct stat {
+struct kernel_stat {
unsigned short st_dev;
unsigned short __pad1;
unsigned long st_ino;
@@ -28,36 +27,8 @@ 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 {
+struct kernel_stat64 {
unsigned char __pad0[6];
unsigned short st_dev;
unsigned char __pad1[2];
@@ -82,7 +53,6 @@ struct stat64 {
unsigned long __pad7; /* will be high 32 bits of ctime someday */
unsigned long long st_ino;
};
-#endif
#endif /* _BITS_STAT_STRUCT_H */
diff --git a/libc/sysdeps/linux/i386/bits/kernel_stat.h b/libc/sysdeps/linux/i386/bits/kernel_stat.h
index 9e7598f5e..5df484fe7 100644
--- a/libc/sysdeps/linux/i386/bits/kernel_stat.h
+++ b/libc/sysdeps/linux/i386/bits/kernel_stat.h
@@ -5,8 +5,7 @@
* struct stat should look like... It turns out each arch has a
* different opinion on the subject... */
-#ifndef __USE_FILE_OFFSET64
-struct stat {
+struct kernel_stat {
unsigned short st_dev;
unsigned short __pad1;
unsigned long st_ino;
@@ -28,33 +27,8 @@ struct stat {
unsigned long __unused4;
unsigned long __unused5;
};
-#else
-struct stat {
- unsigned short st_dev;
- unsigned char __pad0[10];
- 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 {
+struct kernel_stat64 {
unsigned short st_dev;
unsigned char __pad0[10];
#define STAT64_HAS_BROKEN_ST_INO 1
@@ -77,7 +51,6 @@ struct stat64 {
unsigned long __pad7; /* will be high 32 bits of ctime someday */
unsigned long long st_ino;
};
-#endif
#endif /* _BITS_STAT_STRUCT_H */
diff --git a/libc/sysdeps/linux/m68k/bits/kernel_stat.h b/libc/sysdeps/linux/m68k/bits/kernel_stat.h
index 5ca018eac..9152811ba 100644
--- a/libc/sysdeps/linux/m68k/bits/kernel_stat.h
+++ b/libc/sysdeps/linux/m68k/bits/kernel_stat.h
@@ -2,11 +2,10 @@
#define _BITS_STAT_STRUCT_H
/* This file provides whatever this particular arch's kernel thinks
- * struct 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... */
-#ifndef __USE_FILE_OFFSET64
-struct stat {
+struct kernel_stat {
unsigned short st_dev;
unsigned short __pad1;
unsigned long st_ino;
@@ -28,36 +27,8 @@ 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 {
+struct kernel_stat64 {
unsigned char __pad0[6];
unsigned short st_dev;
unsigned char __pad1[2];
@@ -82,7 +53,6 @@ struct stat64 {
unsigned long __pad7; /* will be high 32 bits of ctime someday */
unsigned long long st_ino;
};
-#endif
#endif /* _BITS_STAT_STRUCT_H */
diff --git a/libc/sysdeps/linux/mips/bits/kernel_stat.h b/libc/sysdeps/linux/mips/bits/kernel_stat.h
index 314676456..e8721ee7c 100644
--- a/libc/sysdeps/linux/mips/bits/kernel_stat.h
+++ b/libc/sysdeps/linux/mips/bits/kernel_stat.h
@@ -2,79 +2,13 @@
#define _BITS_STAT_STRUCT_H
/* This file provides whatever this particular arch's kernel thinks
- * struct 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... */
-#if __WORDSIZE == 64
-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;
-};
-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;
-};
+#if __WORDSIZE == 64
+#define kernel_stat kernel_stat64
#else
-
-#ifndef __USE_FILE_OFFSET64
-struct stat {
- unsigned int st_dev;
- long st_pad1[3]; /* Reserved for network id */
- unsigned long st_ino;
- unsigned int st_mode;
- int st_nlink;
- int st_uid;
- int st_gid;
- unsigned int st_rdev;
- long st_pad2[2];
- long st_size;
- long st_pad3;
- long st_atime;
- long reserved0;
- long st_mtime;
- long reserved1;
- long st_ctime;
- long reserved2;
- long st_blksize;
- long st_blocks;
- long st_pad4[14];
-};
-#else
-struct stat {
+struct kernel_stat {
unsigned long st_dev;
unsigned long st_pad0[3]; /* Reserved for st_dev expansion */
unsigned long long st_ino;
@@ -97,8 +31,7 @@ struct stat {
};
#endif
-#ifdef __USE_LARGEFILE64
-struct stat64 {
+struct kernel_stat64 {
unsigned long st_dev;
unsigned long st_pad0[3]; /* Reserved for st_dev expansion */
unsigned long long st_ino;
@@ -119,8 +52,6 @@ struct stat64 {
unsigned long st_pad2;
long long st_blocks;
};
-#endif
-#endif
#endif /* _BITS_STAT_STRUCT_H */
diff --git a/libc/sysdeps/linux/powerpc/bits/kernel_stat.h b/libc/sysdeps/linux/powerpc/bits/kernel_stat.h
index ca3017828..11dc3cc66 100644
--- a/libc/sysdeps/linux/powerpc/bits/kernel_stat.h
+++ b/libc/sysdeps/linux/powerpc/bits/kernel_stat.h
@@ -2,75 +2,12 @@
#define _BITS_STAT_STRUCT_H
/* This file provides whatever this particular arch's kernel thinks
- * struct 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... */
#if __WORDSIZE == 64
-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;
-};
-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;
- unsigned int st_mode;
- unsigned short st_nlink;
- unsigned int st_uid;
- unsigned int st_gid;
- unsigned int st_rdev;
- unsigned long int st_size;
- unsigned long st_blksize;
- unsigned long st_blocks;
- unsigned long st_atime;
- unsigned long __unused1;
- unsigned long st_mtime;
- unsigned long __unused2;
- unsigned long st_ctime;
- unsigned long __unused3;
- unsigned long __unused4;
- unsigned long __unused5;
-};
+#define kernel_stat kernel_stat64
#else
-struct stat {
+struct kernel_stat {
unsigned long long st_dev; /* Device. */
unsigned long long st_ino; /* File serial number. */
unsigned int st_mode; /* File mode. */
@@ -93,8 +30,7 @@ struct stat {
};
#endif
-#ifdef __USE_LARGEFILE64
-struct stat64 {
+struct kernel_stat64 {
unsigned long long st_dev; /* Device. */
unsigned long long st_ino; /* File serial number. */
unsigned int st_mode; /* File mode. */
@@ -115,8 +51,6 @@ struct stat64 {
unsigned long int __unused4;
unsigned long int __unused5;
};
-#endif
-#endif
#endif /* _BITS_STAT_STRUCT_H */
diff --git a/libc/sysdeps/linux/sh/bits/kernel_stat.h b/libc/sysdeps/linux/sh/bits/kernel_stat.h
index 3dc6ebdbf..cd818464d 100644
--- a/libc/sysdeps/linux/sh/bits/kernel_stat.h
+++ b/libc/sysdeps/linux/sh/bits/kernel_stat.h
@@ -2,12 +2,11 @@
#define _BITS_STAT_STRUCT_H
/* This file provides whatever this particular arch's kernel thinks
- * struct 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... */
#include <endian.h>
-#ifndef __USE_FILE_OFFSET64
-struct stat {
+struct kernel_stat {
unsigned short st_dev;
unsigned short __pad1;
unsigned long st_ino;
@@ -29,62 +28,8 @@ 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 {
+struct kernel_stat64 {
#if defined(__BIG_ENDIAN__)
unsigned char __pad0b[6];
unsigned short st_dev;
@@ -135,8 +80,6 @@ struct stat64 {
unsigned long __unused1;
unsigned long __unused2;
};
-#endif
-
#endif /* _BITS_STAT_STRUCT_H */
diff --git a/libc/sysdeps/linux/sparc/bits/kernel_stat.h b/libc/sysdeps/linux/sparc/bits/kernel_stat.h
index b476abb60..3b56a919f 100644
--- a/libc/sysdeps/linux/sparc/bits/kernel_stat.h
+++ b/libc/sysdeps/linux/sparc/bits/kernel_stat.h
@@ -2,81 +2,12 @@
#define _BITS_STAT_STRUCT_H
/* This file provides whatever this particular arch's kernel thinks
- * struct 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... */
#if __WORDSIZE == 64
-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;
-};
-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;
-};
-
+#define kernel_stat kernel_stat64
#else
-#ifndef __USE_FILE_OFFSET64
-struct stat {
- unsigned short st_dev;
- unsigned long st_ino;
- unsigned short st_mode;
- short st_nlink;
- unsigned short st_uid;
- unsigned short st_gid;
- unsigned short st_rdev;
- long st_size;
- long st_atime;
- unsigned long __unused1;
- long st_mtime;
- unsigned long __unused2;
- long st_ctime;
- unsigned long __unused3;
- long st_blksize;
- long st_blocks;
- unsigned long __unused4[2];
-};
-#else
-struct stat {
+struct kernel_stat {
unsigned char __pad0[6];
unsigned short st_dev;
unsigned long long st_ino;
@@ -102,8 +33,7 @@ struct stat {
};
#endif
-#ifdef __USE_LARGEFILE64
-struct stat64 {
+struct kernel_stat64 {
unsigned char __pad0[6];
unsigned short st_dev;
unsigned long long st_ino;
@@ -127,8 +57,6 @@ struct stat64 {
unsigned int __unused4;
unsigned int __unused5;
};
-#endif
-#endif
#endif /* _BITS_STAT_STRUCT_H */
diff --git a/libc/sysdeps/linux/v850/bits/kernel_stat.h b/libc/sysdeps/linux/v850/bits/kernel_stat.h
index 435c2ce86..a4093aec0 100644
--- a/libc/sysdeps/linux/v850/bits/kernel_stat.h
+++ b/libc/sysdeps/linux/v850/bits/kernel_stat.h
@@ -1,8 +1,6 @@
/* Stat structure for linux/v850 */
-#ifndef __USE_FILE_OFFSET64
-
-struct stat
+struct kernel_stat
{
__kernel_dev_t st_dev;
__kernel_ino_t st_ino;
@@ -24,9 +22,7 @@ struct stat
unsigned long __unused5;
};
-#else /* __USE_FILE_OFFSET64 */
-
-struct stat
+struct kernel_stat64
{
__kernel_dev_t st_dev;
unsigned long __unused0;
@@ -60,39 +56,3 @@ struct stat
unsigned long __unused7; /* high 32 bits of ctime someday */
};
-#endif /* __USE_FILE_OFFSET64 */
-
-
-struct stat64
-{
- __kernel_dev_t st_dev;
- unsigned long __unused0;
- unsigned long __unused1;
-
- __kernel_ino64_t st_ino;
-
- __kernel_mode_t st_mode;
- __kernel_nlink_t st_nlink;
-
- __kernel_uid_t st_uid;
- __kernel_gid_t st_gid;
-
- __kernel_dev_t st_rdev;
- unsigned long __unused2;
- unsigned long __unused3;
-
- __kernel_loff_t st_size;
- unsigned long st_blksize;
-
- unsigned long __unused4; /* future possible st_blocks high bits */
- unsigned long st_blocks; /* Number 512-byte blocks allocated. */
-
- unsigned long st_atime;
- unsigned long __unused5;
-
- unsigned long st_mtime;
- unsigned long __unused6;
-
- unsigned long st_ctime;
- unsigned long __unused7; /* high 32 bits of ctime someday */
-};