From e21479da34bbe39fb9d99e2f6e323fd1a942d9cb Mon Sep 17 00:00:00 2001 From: "Peter S. Mazinger" Date: Sat, 16 Apr 2011 01:07:23 +0200 Subject: *64.[cS]: use _lfs_64.h instead of features.h and remove LFS guard _lfs_64.h makes the compile fail, if LFS is not enabled, no need for the guard. Reorganize to include only the minimal necessary headers. Signed-off-by: Peter S. Mazinger Signed-off-by: Bernhard Reutner-Fischer --- libc/sysdeps/linux/common/truncate64.c | 47 ++++++++++++---------------------- 1 file changed, 17 insertions(+), 30 deletions(-) (limited to 'libc/sysdeps/linux/common/truncate64.c') diff --git a/libc/sysdeps/linux/common/truncate64.c b/libc/sysdeps/linux/common/truncate64.c index 1f6c4596a..6dfdc4c07 100644 --- a/libc/sysdeps/linux/common/truncate64.c +++ b/libc/sysdeps/linux/common/truncate64.c @@ -10,46 +10,36 @@ * just the macro we need to order things, __LONG_LONG_PAIR. */ -#include -#include -#include -#include -#include -#include +#include <_lfs_64.h> #include +#include -#if defined __UCLIBC_HAS_LFS__ - -#if defined __NR_truncate64 - -#if __WORDSIZE == 64 +#ifdef __NR_truncate64 +# include -/* For a 64 bit machine, life is simple... */ +# if __WORDSIZE == 64 _syscall2(int, truncate64, const char *, path, __off64_t, length) - -#elif __WORDSIZE == 32 - -/* The exported truncate64 function. */ +# elif __WORDSIZE == 32 +# include +# include int truncate64(const char * path, __off64_t length) { uint32_t low = length & 0xffffffff; uint32_t high = length >> 32; -#if defined(__UCLIBC_TRUNCATE64_HAS_4_ARGS__) +# if defined(__UCLIBC_TRUNCATE64_HAS_4_ARGS__) return INLINE_SYSCALL(truncate64, 4, path, 0, __LONG_LONG_PAIR(high, low)); -#else +# else return INLINE_SYSCALL(truncate64, 3, path, __LONG_LONG_PAIR(high, low)); -#endif +# endif } +# else +# error Your machine is not 64 bit nor 32 bit, I am dazed and confused. +# endif -#else /* __WORDSIZE */ -#error Your machine is not 64 bit nor 32 bit, I am dazed and confused. -#endif /* __WORDSIZE */ - -#else /* __NR_truncate64 */ - - +#else +# include int truncate64(const char * path, __off64_t length) { __off_t x = (__off_t) length; @@ -62,7 +52,4 @@ int truncate64(const char * path, __off64_t length) return -1; } - -#endif /* __NR_truncate64 */ - -#endif /* __UCLIBC_HAS_LFS__ */ +#endif -- cgit v1.2.3