summaryrefslogtreecommitdiff
path: root/libc/sysdeps/linux/common/truncate64.c
diff options
context:
space:
mode:
authorPeter S. Mazinger <ps.m@gmx.net>2011-04-16 01:07:23 +0200
committerBernhard Reutner-Fischer <rep.dot.nop@gmail.com>2012-06-15 14:00:37 +0200
commite21479da34bbe39fb9d99e2f6e323fd1a942d9cb (patch)
treef1240e0f522f2515cf27b48fe11c38eecaa00a90 /libc/sysdeps/linux/common/truncate64.c
parenta4b93f0bef877d6e996037696ecb1779bfe46074 (diff)
*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 <ps.m@gmx.net> Signed-off-by: Bernhard Reutner-Fischer <rep.dot.nop@gmail.com>
Diffstat (limited to 'libc/sysdeps/linux/common/truncate64.c')
-rw-r--r--libc/sysdeps/linux/common/truncate64.c47
1 files changed, 17 insertions, 30 deletions
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 <features.h>
-#include <unistd.h>
-#include <errno.h>
-#include <endian.h>
-#include <stdint.h>
-#include <sys/types.h>
+#include <_lfs_64.h>
#include <sys/syscall.h>
+#include <unistd.h>
-#if defined __UCLIBC_HAS_LFS__
-
-#if defined __NR_truncate64
-
-#if __WORDSIZE == 64
+#ifdef __NR_truncate64
+# include <bits/wordsize.h>
-/* 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 <endian.h>
+# include <stdint.h>
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 <errno.h>
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