summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorEric Andersen <andersen@codepoet.org>2002-05-30 08:51:13 +0000
committerEric Andersen <andersen@codepoet.org>2002-05-30 08:51:13 +0000
commitef2e41138a4c23d6cb02710d091517d4ef33a110 (patch)
tree2294865f6f91e10d69c336c7682a684b43e00771
parentd68fdbb8a3bd3c75b68eda51aed5dff88620d391 (diff)
Make these properly cope with 64bit systems
-Erik
-rw-r--r--libc/sysdeps/linux/common/statfix.h16
-rw-r--r--libc/sysdeps/linux/common/statfix64.h48
2 files changed, 35 insertions, 29 deletions
diff --git a/libc/sysdeps/linux/common/statfix.h b/libc/sysdeps/linux/common/statfix.h
index 3978c6473..3d18dd408 100644
--- a/libc/sysdeps/linux/common/statfix.h
+++ b/libc/sysdeps/linux/common/statfix.h
@@ -1,26 +1,28 @@
#ifndef STATFIX_H
#define STATFIX_H
+#include <features.h>
+#undef __OPTIMIZE__
#include <sys/types.h>
/* Pull in whatever this particular arch's kernel thinks the kernel version of
- * 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... */
+ * * 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... */
#define stat kernel_stat
#define new_stat kernel_stat
-#define stat64 kernel_stat64
-#include <asm/stat.h>
-#undef stat64
+#include <asm/stat.h>
#undef new_stat
#undef stat
/* Now pull in libc's version of stat */
#define stat libc_stat
-#include <sys/stat.h>
+#define stat64 libc_stat64
+#define _SYS_STAT_H
+#include <bits/stat.h>
+#undef stat64
#undef stat
extern void statfix(struct libc_stat *libcstat, struct kernel_stat *kstat);
extern int __fxstat(int version, int fd, struct libc_stat * statbuf);
#endif
-
diff --git a/libc/sysdeps/linux/common/statfix64.h b/libc/sysdeps/linux/common/statfix64.h
index a35ca7ae3..4b6d0c670 100644
--- a/libc/sysdeps/linux/common/statfix64.h
+++ b/libc/sysdeps/linux/common/statfix64.h
@@ -2,7 +2,9 @@
#define STATFIX_H
#include <features.h>
-#include <limits.h>
+#undef __OPTIMIZE__
+#include <sys/types.h>
+#include <bits/wordsize.h>
#if defined _FILE_OFFSET_BITS && _FILE_OFFSET_BITS != 64
#undef _FILE_OFFSET_BITS
@@ -12,25 +14,24 @@
# define __USE_LARGEFILE64 1
#endif
/* We absolutely do _NOT_ want interfaces silently
- * * renamed under us or very bad things will happen... */
+ * * * renamed under us or very bad things will happen... */
#ifdef __USE_FILE_OFFSET64
# undef __USE_FILE_OFFSET64
#endif
-#ifdef __UCLIBC_HAVE_LFS__
-#if defined __WORDSIZE && __WORDSIZE < 64
+#if defined __UCLIBC_HAVE_LFS__
+#if defined __WORDSIZE && (__WORDSIZE >= 64)
-#include <sys/types.h>
+/* 64 bit arch stuff... */
/* Pull in whatever this particular arch's kernel thinks the kernel version of
- * 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... */
-#define stat kernel_stat
-#define new_stat kernel_stat
+ * * 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... */
+#define stat kernel_stat64
+#define new_stat kernel_stat64
#define stat64 kernel_stat64
-#define new_stat64 kernel_stat64
+#define kernel_stat kernel_stat64
#include <asm/stat.h>
-#undef new_stat64
#undef stat64
#undef new_stat
#undef stat
@@ -39,40 +40,43 @@
/* Now pull in libc's version of stat */
#define stat libc_stat
#define stat64 libc_stat64
-#include <sys/stat.h>
+#define _SYS_STAT_H
+#include <bits/stat.h>
#undef stat64
#undef stat
extern void statfix64(struct libc_stat64 *libcstat, struct kernel_stat64 *kstat);
extern int __fxstat64(int version, int fd, struct libc_stat64 * statbuf);
-#else /* __WORDSIZE */
-#include <sys/types.h>
+
+#else
+
+/* 32 bit arch stuff */
+
/* Pull in whatever this particular arch's kernel thinks the kernel version of
- * 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... */
+ * * 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... */
#define stat kernel_stat
#define new_stat kernel_stat
-#define kernel_stat64 kernel_stat
-#include <asm/stat.h>
-#undef new_stat64
+#define stat64 kernel_stat64
+#include <asm/stat.h>
#undef stat64
#undef new_stat
#undef stat
-
/* Now pull in libc's version of stat */
#define stat libc_stat
#define stat64 libc_stat64
-#include <sys/stat.h>
+#define _SYS_STAT_H
+#include <bits/stat.h>
#undef stat64
#undef stat
extern void statfix64(struct libc_stat64 *libcstat, struct kernel_stat64 *kstat);
extern int __fxstat64(int version, int fd, struct libc_stat64 * statbuf);
+
#endif /* __WORDSIZE */
#endif /* __UCLIBC_HAVE_LFS__ */
#endif
-