From: Markos Chandras <[email protected]>

Signed-off-by: Markos Chandras <[email protected]>
---
 libc/sysdeps/linux/common/ftruncate.c | 18 ++++++++++++++++++
 1 file changed, 18 insertions(+)

diff --git a/libc/sysdeps/linux/common/ftruncate.c 
b/libc/sysdeps/linux/common/ftruncate.c
index ea4dfc0..b8409f3 100644
--- a/libc/sysdeps/linux/common/ftruncate.c
+++ b/libc/sysdeps/linux/common/ftruncate.c
@@ -8,7 +8,25 @@
  */
 
 #include <sys/syscall.h>
+#include <endian.h>
+#include <stdint.h>
 #include <unistd.h>
 
+#if defined(__NR_ftruncate64) && !defined(__NR_ftruncate)
+int ftruncate(int fd, __off_t length)
+{
+#if defined __UCLIBC_HAS_LFS__
+       return ftruncate64(fd, length);
+#elif __WORDSIZE == 32
+       uint32_t high = length & (1<<31) ? 0xffffffff : 0;
+
+       return INLINE_SYSCALL(ftruncate64, 3, fd,
+                             __LONG_LONG_PAIR (high, length));
+#endif
+}
+libc_hidden_def(ftruncate);
+
+#else
 _syscall2(int, ftruncate, int, fd, __off_t, length)
 libc_hidden_def(ftruncate)
+#endif
-- 
1.8.1.1


_______________________________________________
uClibc mailing list
[email protected]
http://lists.busybox.net/mailman/listinfo/uclibc

Reply via email to