openwrt/obsolete-buildroot/sources/uClibc-ftruncate.patch
Mike Baker c5255b8a5d andersee's ftruncate patch
SVN-Revision: 117
2004-07-31 02:02:39 +00:00

71 lines
2.4 KiB
Diff

--- uClibc/libc/sysdeps/linux/common/ftruncate64.c 17 Nov 2003 01:24:07 -0000 1.10
+++ uClibc/libc/sysdeps/linux/common/ftruncate64.c 21 Jul 2004 07:13:38 -0000
@@ -23,7 +23,7 @@
#if defined __NR_ftruncate64
-#if __WORDSIZE == 64 || (defined(__powerpc__) && defined (__UCLIBC_HAS_LFS__))
+#if __WORDSIZE == 64
/* For a 64 bit machine, life is simple... */
_syscall2(int, ftruncate64, int, fd, __off64_t, length);
@@ -33,15 +33,25 @@
#ifndef INLINE_SYSCALL
#define INLINE_SYSCALL(name, nr, args...) __syscall_ftruncate64 (args)
#define __NR___syscall_ftruncate64 __NR_ftruncate64
+#if defined(__powerpc__) || defined(__mips__)
+static inline _syscall4(int, __syscall_ftruncate64, int, fd, int, pad, int, high_length, int, low_length);
+#else
static inline _syscall3(int, __syscall_ftruncate64, int, fd, int, high_length, int, low_length);
#endif
+#endif
/* The exported ftruncate64 function. */
int ftruncate64 (int fd, __off64_t length)
{
uint32_t low = length & 0xffffffff;
uint32_t high = length >> 32;
- return INLINE_SYSCALL(ftruncate64, 3, fd, __LONG_LONG_PAIR (high, low));
+ return INLINE_SYSCALL(ftruncate64,
+#if defined(__powerpc__) || defined(__mips__)
+ 4, fd, 0,
+#else
+ 3, fd,
+#endif
+ __LONG_LONG_PAIR (high, low));
}
#else /* __WORDSIZE */
--- uClibc/libc/sysdeps/linux/common/truncate64.c 15 Nov 2002 14:06:44 -0000 1.8
+++ uClibc/libc/sysdeps/linux/common/truncate64.c 21 Jul 2004 07:13:38 -0000
@@ -33,7 +33,13 @@
#ifndef INLINE_SYSCALL
#define INLINE_SYSCALL(name, nr, args...) __syscall_truncate64 (args)
#define __NR___syscall_truncate64 __NR_truncate64
-static inline _syscall3(int, __syscall_truncate64, const char *, path, int, high_length, int, low_length);
+#if defined(__powerpc__) || defined(__mips__)
+static inline _syscall4(int, __syscall_truncate64, const char *, path,
+ int, pad, int, high_length, int, low_length);
+#else
+static inline _syscall3(int, __syscall_truncate64, const char *, path,
+ int, high_length, int, low_length);
+#endif
#endif
@@ -42,7 +48,13 @@
{
uint32_t low = length & 0xffffffff;
uint32_t high = length >> 32;
- return INLINE_SYSCALL(truncate64, 3, path, __LONG_LONG_PAIR (high, low));
+ return INLINE_SYSCALL(truncate64,
+#if defined(__powerpc__) || defined(__mips__)
+ 4, path, 0,
+#else
+ 3, path,
+#endif
+ __LONG_LONG_PAIR (high, low));
}
#endif /* __UCLIBC_HAS_LFS__ */