[uClibc]Re: LFS on v850
Miles Bader
miles at lsi.nec.co.jp
Tue Feb 26 08:53:16 UTC 2002
mjn3 at codepoet.org (Manuel Novoa III) writes:
> you could check bits/wordsize.h.
That seems good enough for this application, assuming that __WORDSIZE
corresponds to the processor's `natural' wordsize (the size of the
registers, etc).
Then I'd do something like the following:
--- syscalls.c.~1.62.~ Tue Feb 26 13:23:34 2002
+++ syscalls.c Tue Feb 26 17:30:05 2002
@@ -1408,20 +1408,28 @@ _syscall4(ssize_t,sendfile, int, out_fd,
//#define __NR_mmap2 192
-//#define __NR_truncate64 193
#ifdef __UCLIBC_HAVE_LFS__
+#include <bits/wordsize.h>
+
+/* We only implement truncate64/ftruncate64 on 64-bit systems, because using
+ _syscall2 to pass 64-bit arguments generally only works there. Ports for
+ processors with shorter word-lengths should define their own custom
+ versions. */
+#if __WORDSIZE >= 64
+
+//#define __NR_truncate64 193
#ifdef L_truncate64
#include <unistd.h>
_syscall2(int, truncate64, const char *, path, __off64_t, length);
#endif
-#endif /* __UCLIBC_HAVE_LFS__ */
//#define __NR_ftruncate64 194
-#ifdef __UCLIBC_HAVE_LFS__
#ifdef L_ftruncate64
#include <unistd.h>
_syscall2(int, ftruncate64, int, fd, __off64_t, length);
#endif
+
+#endif /* __WORDSIZE >= 64 */
#endif /* __UCLIBC_HAVE_LFS__ */
[this will result in empty object files for truncate64 and ftruncate64
on 32-bit processors, but that should be alright]
thanks,
-Miles
--
Suburbia: where they tear out the trees and then name streets after them.
More information about the uClibc
mailing list