[PATCH] Bionic lacks transparent LFS migrations; provide a workaround
Matt Whitlock
busybox at mattwhitlock.name
Fri Apr 24 21:42:21 UTC 2015
This solves some of the problems arising from Bionic's off_t being 32 bits wide despite _FILE_OFFSET_BITS==64. See BusyBox bug #6908.
Note that this doesn't solve all such problems since Bionic lacks 64-bit variants of many standard I/O functions: open, creat, lockf, posix_fadvise, posix_fallocate, truncate, sendfile, getrlimit, setrlimit, fopen, freopen, fseeko, ftello, fgetpos, fsetpos, mkstemp.
---
include/platform.h | 19 +++++++++++++++++++
1 file changed, 19 insertions(+)
diff --git a/include/platform.h b/include/platform.h
index 9893536..1744b3c 100644
--- a/include/platform.h
+++ b/include/platform.h
@@ -491,6 +491,25 @@ typedef unsigned smalluint;
# undef HAVE_NET_ETHERNET_H
#endif
+/* Bionic system headers lack transparent LFS migrations. */
+#if defined(__BIONIC__) && defined(_FILE_OFFSET_BITS) && _FILE_OFFSET_BITS == 64
+/* from <unistd.h> */
+# define lseek lseek64
+# define pread pread64
+# define pwrite pwrite64
+# define ftruncate ftruncate64
+/* from <sys/types.h> */
+# define off_t off64_t
+# define ino_t ino64_t
+# define blkcnt_t blkcnt64_t
+# define fsblkcnt_t fsblkcnt64_t
+# define fsfilcnt_t fsfilcnt64_t
+typedef uint64_t ino_t;
+typedef uint64_t blkcnt_t;
+typedef uint64_t fsblkcnt_t;
+typedef uint64_t fsfilcnt_t;
+#endif
+
/*
* Now, define prototypes for all the functions defined in platform.c
* These must come after all the HAVE_* macros are defined (or not)
--
2.0.5
More information about the busybox
mailing list