summaryrefslogtreecommitdiff
path: root/libc/sysdeps/linux/common/ftruncate64.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/ftruncate64.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/ftruncate64.c')
-rw-r--r--libc/sysdeps/linux/common/ftruncate64.c43
1 files changed, 18 insertions, 25 deletions
diff --git a/libc/sysdeps/linux/common/ftruncate64.c b/libc/sysdeps/linux/common/ftruncate64.c
index c5a616007..012a1f4ed 100644
--- a/libc/sysdeps/linux/common/ftruncate64.c
+++ b/libc/sysdeps/linux/common/ftruncate64.c
@@ -10,47 +10,42 @@
* just the macro we need to order things, __LONG_LONG_PAIR.
*/
-#include <features.h>
+#include <_lfs_64.h>
+#include <sys/syscall.h>
+#include <unistd.h>
-#ifdef __UCLIBC_HAS_LFS__
+#ifdef __NR_ftruncate64
+# include <bits/wordsize.h>
-# include <unistd.h>
-# include <errno.h>
-# include <endian.h>
-# include <stdint.h>
-# include <sys/types.h>
-# include <sys/syscall.h>
-
-
-# ifdef __NR_ftruncate64
-
-# if __WORDSIZE == 64
+# if __WORDSIZE == 64
/* For a 64 bit machine, life is simple... */
_syscall2(int, ftruncate64, int, fd, __off64_t, length)
-# elif __WORDSIZE == 32
+# elif __WORDSIZE == 32
+# include <endian.h>
+# include <stdint.h>
/* The exported ftruncate64 function. */
int ftruncate64 (int fd, __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(ftruncate64,
4, fd, 0, __LONG_LONG_PAIR (high, low));
-# else
+# else
return INLINE_SYSCALL(ftruncate64, 3, fd,
__LONG_LONG_PAIR (high, low));
-# endif
+# endif
}
-# else /* __WORDSIZE */
-# error Your machine is not 64 bit or 32 bit, I am dazed and confused.
-# endif /* __WORDSIZE */
-
-# else /* __NR_ftruncate64 */
+# else /* __WORDSIZE */
+# error Your machine is not 64 bit or 32 bit, I am dazed and confused.
+# endif /* __WORDSIZE */
+#else /* __NR_ftruncate64 */
+# include <errno.h>
int ftruncate64 (int fd, __off64_t length)
{
@@ -65,7 +60,5 @@ int ftruncate64 (int fd, __off64_t length)
return -1;
}
-# endif /* __NR_ftruncate64 */
+#endif /* __NR_ftruncate64 */
libc_hidden_def(ftruncate64)
-
-#endif /* __UCLIBC_HAS_LFS__ */