summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorManuel Novoa III <mjn3@codepoet.org>2002-02-19 19:27:12 +0000
committerManuel Novoa III <mjn3@codepoet.org>2002-02-19 19:27:12 +0000
commit4c210f02a200496e2693e41a21ef5f8727d91f56 (patch)
treed8db6b36357505a141545a95eb8994c171883e5c
parentc6b92ee07f4c13cf82bfe256101e48498bb6301b (diff)
Output an error if uClibc's and app's largefile configuration are incompatible.
-rw-r--r--include/features.h34
-rw-r--r--libc/sysdeps/linux/common/statfix.h2
2 files changed, 36 insertions, 0 deletions
diff --git a/include/features.h b/include/features.h
index 562dca91f..033cf98d6 100644
--- a/include/features.h
+++ b/include/features.h
@@ -85,6 +85,11 @@
but are implied by the other feature-test macros defined (or by the
lack of any definitions) are defined by the file. */
+/* First, record if user requested some form of large file support. */
+#if defined(_LARGEFILE_SOURCE) || defined(_LARGEFILE64_SOURCE) \
+ || (defined(_FILE_OFFSET_BITS) && _FILE_OFFSET_BITS == 64)
+# define __USER_REQUESTED_LFS_OPTION 1
+#endif
/* Undefine everything, so we get a clean slate. */
#undef __USE_ISOC99
@@ -331,6 +336,35 @@
#include <bits/uClibc_config.h>
#undef __need_uClibc_config_h
+/* Make sure users large file options agree with uClibc's configuration. */
+#ifndef __UCLIBC_HAVE_LFS__
+/* If uClibc was built without large file support, output an error if
+ * large file functions are requested. */
+#ifdef __USER_REQUESTED_LFS_OPTION
+#error uClibc was configured without large file support...
+/* Since _LARGEFILE_SOURCE and _LARGEFILE64_SOURCE can be turned by
+ * other options, disable them with a warning if they were enabled. */
+#elif defined(_LARGEFILE_SOURCE) || defined(_LARGEFILE64_SOURCE)
+#warning uClibc was configured without large file support...
+#endif
+#undef _LARGEFILE_SOURCE
+#undef _LARGEFILE64_SOURCE
+#undef _FILE_OFFSET_BITS
+#undef __USE_LARGEFILE
+#undef __USE_LARGEFILE64
+#undef __USE_FILE_OFFSET64
+/* If we're actually building uClibc with large file support,
+ * define __USE_LARGEFILE64 only. */
+#elif defined(_LIBC)
+#undef _LARGEFILE_SOURCE
+#undef _LARGEFILE64_SOURCE
+#undef _FILE_OFFSET_BITS
+#undef __USE_LARGEFILE
+#undef __USE_LARGEFILE64
+#undef __USE_FILE_OFFSET64
+#define __USE_LARGEFILE64 1
+#endif
+
/* Some nice features only work properly with ELF */
#if defined _LIBC && defined HAVE_ELF
/* Define ALIASNAME as a weak alias for NAME. */
diff --git a/libc/sysdeps/linux/common/statfix.h b/libc/sysdeps/linux/common/statfix.h
index 0d1dbfa89..3978c6473 100644
--- a/libc/sysdeps/linux/common/statfix.h
+++ b/libc/sysdeps/linux/common/statfix.h
@@ -8,7 +8,9 @@
* 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
#undef new_stat
#undef stat