[git commit future] posix_fadvise: make posix_fadvise[64] similar on all archs
Peter S. Mazinger
ps.m at gmx.net
Wed Mar 30 11:53:36 UTC 2011
commit: http://git.uclibc.org/uClibc/commit/?id=f3d1b79a84dbfa2cb967ce5a067b54dfce6aaafe
branch: http://git.uclibc.org/uClibc/commit/?id=refs/heads/future
Remove all versions, that can be covered by the common one.
Drop incorrectly implemented fallback support, if __NR_fadvise64_64 is not available.
To support 64 bit ppc, move ppc support into common.
Cleanup including headers.
Signed-off-by: Peter S. Mazinger <ps.m at gmx.net>
---
libc/sysdeps/linux/arm/Makefile.arch | 2 +-
libc/sysdeps/linux/arm/posix_fadvise.c | 42 ++++-----------
libc/sysdeps/linux/arm/posix_fadvise64.c | 59 ---------------------
libc/sysdeps/linux/common/posix_fadvise.c | 35 +++++++------
libc/sysdeps/linux/common/posix_fadvise64.c | 72 ++++++++------------------
libc/sysdeps/linux/mips/posix_fadvise.c | 23 ++++----
libc/sysdeps/linux/mips/posix_fadvise64.c | 32 ++++-------
libc/sysdeps/linux/powerpc/Makefile.arch | 4 --
libc/sysdeps/linux/powerpc/posix_fadvise.c | 36 -------------
libc/sysdeps/linux/powerpc/posix_fadvise64.c | 69 ------------------------
libc/sysdeps/linux/xtensa/Makefile.arch | 2 +-
libc/sysdeps/linux/xtensa/posix_fadvise.c | 22 ++++----
libc/sysdeps/linux/xtensa/posix_fadvise64.c | 39 --------------
13 files changed, 87 insertions(+), 350 deletions(-)
delete mode 100644 libc/sysdeps/linux/arm/posix_fadvise64.c
delete mode 100644 libc/sysdeps/linux/powerpc/posix_fadvise.c
delete mode 100644 libc/sysdeps/linux/powerpc/posix_fadvise64.c
delete mode 100644 libc/sysdeps/linux/xtensa/posix_fadvise64.c
diff --git a/libc/sysdeps/linux/arm/Makefile.arch b/libc/sysdeps/linux/arm/Makefile.arch
index 7918ac1..3267513 100644
--- a/libc/sysdeps/linux/arm/Makefile.arch
+++ b/libc/sysdeps/linux/arm/Makefile.arch
@@ -21,7 +21,7 @@ SSRC += libc-aeabi_read_tp.S libc-thumb_atomics.S
endif
ifeq ($(UCLIBC_HAS_ADVANCED_REALTIME),y)
-CSRC += posix_fadvise.c posix_fadvise64.c
+CSRC += posix_fadvise.c
endif
ifeq ($(CONFIG_ARM_EABI),y)
diff --git a/libc/sysdeps/linux/arm/posix_fadvise.c b/libc/sysdeps/linux/arm/posix_fadvise.c
index 80d3c50..17bffb5 100644
--- a/libc/sysdeps/linux/arm/posix_fadvise.c
+++ b/libc/sysdeps/linux/arm/posix_fadvise.c
@@ -8,42 +8,24 @@
* Licensed under the LGPL v2.1, see the file COPYING.LIB in this tarball.
*/
#include <sys/syscall.h>
-#include <fcntl.h>
-#if defined __NR_arm_fadvise64_64
+#ifdef __NR_arm_fadvise64_64
+# include <fcntl.h>
+# include <endian.h>
-#define HIGH_BITS(x) (sizeof(x) > 4 ? (x) >> 32 : 0)
-
-/* Was named __libc_posix_fadvise for some inexplicable reason.
-** google says only uclibc has *__libc*_posix_fadviseXXX,
-** so it cannot be compat with anything.
-**
-** Remove this comment and one at the end after 0.9.31
-*/
+# define HIGH_BITS(x) (sizeof(x) > 4 ? (x) >> 32 : 0)
/* This is for the ARM version of fadvise64_64 which swaps the params
* * about to avoid having ABI compat issues
* */
-#define __NR___syscall_arm_fadvise64_64 __NR_arm_fadvise64_64
-int posix_fadvise(int fd, off_t offset, off_t len, int advise)
-{
- INTERNAL_SYSCALL_DECL (err);
- int ret = INTERNAL_SYSCALL (arm_fadvise64_64, err, 6, fd, advise,
- __LONG_LONG_PAIR (HIGH_BITS(offset), (long)offset),
- __LONG_LONG_PAIR (HIGH_BITS(len), (long)len));
-
- if (INTERNAL_SYSCALL_ERROR_P (ret, err))
- return INTERNAL_SYSCALL_ERRNO (ret, err);
- return 0;
-}
-
-/* weak_alias(__libc_posix_fadvise, posix_fadvise); */
-
-#elif defined __UCLIBC_HAS_STUBS__
-
-int posix_fadvise(int fd attribute_unused, off_t offset attribute_unused, off_t len attribute_unused, int advice attribute_unused)
+int posix_fadvise(int fd, off_t offset, off_t len, int advice)
{
- return ENOSYS;
+ INTERNAL_SYSCALL_DECL (err);
+ int ret = INTERNAL_SYSCALL (arm_fadvise64_64, err, 6, fd, advice,
+ __LONG_LONG_PAIR (HIGH_BITS(offset), (long)offset),
+ __LONG_LONG_PAIR (HIGH_BITS(len), (long)len));
+ if (INTERNAL_SYSCALL_ERROR_P (ret, err))
+ return INTERNAL_SYSCALL_ERRNO (ret, err);
+ return 0;
}
-
#endif
diff --git a/libc/sysdeps/linux/arm/posix_fadvise64.c b/libc/sysdeps/linux/arm/posix_fadvise64.c
deleted file mode 100644
index 678c42f..0000000
--- a/libc/sysdeps/linux/arm/posix_fadvise64.c
+++ /dev/null
@@ -1,59 +0,0 @@
-/* vi: set sw=4 ts=4: */
-/*
- * posix_fadvise64() for ARM uClibc
- * http://www.opengroup.org/onlinepubs/009695399/functions/posix_fadvise.html
- *
- * Copyright (C) 2000-2006 Erik Andersen <andersen at uclibc.org>
- *
- * Licensed under the LGPL v2.1, see the file COPYING.LIB in this tarball.
- */
-
-#include <features.h>
-#include <unistd.h>
-#include <errno.h>
-#include <endian.h>
-#include <stdint.h>
-#include <sys/types.h>
-#include <sys/syscall.h>
-#include <fcntl.h>
-
-#ifdef __UCLIBC_HAS_LFS__
-
-#if defined __NR_arm_fadvise64_64
-
-/* Was named __libc_posix_fadvise64 for some inexplicable reason.
-** google says only uclibc has *__libc*_posix_fadviseXXX,
-** so it cannot be compat with anything.
-**
-** Remove this comment and one at the end after 0.9.31
-*/
-
-/* This is for the ARM version of fadvise64_64 which swaps the params
- * about to avoid having ABI compat issues
- */
-#define __NR___syscall_arm_fadvise64_64 __NR_arm_fadvise64_64
-int posix_fadvise64(int fd, __off64_t offset, __off64_t len, int advise)
-{
- INTERNAL_SYSCALL_DECL (err);
- int ret = INTERNAL_SYSCALL (arm_fadvise64_64, err, 6, fd, advise,
- __LONG_LONG_PAIR ((long)(offset >> 32), (long)offset),
- __LONG_LONG_PAIR ((long)(len >> 32), (long)len));
- if (!INTERNAL_SYSCALL_ERROR_P (ret, err))
- return 0;
- if (INTERNAL_SYSCALL_ERRNO (ret, err) != ENOSYS)
- return INTERNAL_SYSCALL_ERRNO (ret, err);
- return 0;
-}
-
-/* weak_alias(__libc_posix_fadvise64, posix_fadvise64); */
-
-#elif defined __UCLIBC_HAS_STUBS__
-
-int posix_fadvise64(int fd, __off64_t offset, __off64_t len, int advise)
-{
- return ENOSYS;
-}
-
-#endif
-
-#endif
diff --git a/libc/sysdeps/linux/common/posix_fadvise.c b/libc/sysdeps/linux/common/posix_fadvise.c
index 17831c2..b2e4c14 100644
--- a/libc/sysdeps/linux/common/posix_fadvise.c
+++ b/libc/sysdeps/linux/common/posix_fadvise.c
@@ -9,27 +9,30 @@
*/
#include <sys/syscall.h>
-#include <fcntl.h>
#ifdef __NR_fadvise64
-#define __NR_posix_fadvise __NR_fadvise64
+# include <fcntl.h>
+# include <endian.h>
+# include <bits/wordsize.h>
+
int posix_fadvise(int fd, off_t offset, off_t len, int advice)
{
INTERNAL_SYSCALL_DECL(err);
- int ret = (int) (INTERNAL_SYSCALL(posix_fadvise, err, 5, fd,
- __LONG_LONG_PAIR (offset >> 31, offset), len, advice));
- if (INTERNAL_SYSCALL_ERROR_P (ret, err))
- return INTERNAL_SYSCALL_ERRNO (ret, err);
- return 0;
+# if __WORDSIZE == 64
+ int ret = INTERNAL_SYSCALL(fadvise64, err, 4, fd, offset, len, advice);
+# else
+# ifdef __powerpc__
+ int ret = INTERNAL_SYSCALL(fadvise64, err, 6, fd, 0
+# else
+ int ret = INTERNAL_SYSCALL(fadvise64, err, 5, fd,
+# endif
+ __LONG_LONG_PAIR (offset >> 31, offset), len, advice);
+# endif
+ if (INTERNAL_SYSCALL_ERROR_P (ret, err))
+ return INTERNAL_SYSCALL_ERRNO (ret, err);
+ return 0;
}
-
-#if defined __UCLIBC_HAS_LFS__ && !defined __NR_fadvise64_64
+# if defined __UCLIBC_HAS_LFS__ && (!defined __NR_fadvise64_64 || __WORDSIZE == 64)
strong_alias(posix_fadvise,posix_fadvise64)
-#endif
-
-#elif defined __UCLIBC_HAS_STUBS__
-int posix_fadvise(int fd attribute_unused, off_t offset attribute_unused, off_t len attribute_unused, int advice attribute_unused)
-{
- return ENOSYS;
-}
+# endif
#endif
diff --git a/libc/sysdeps/linux/common/posix_fadvise64.c b/libc/sysdeps/linux/common/posix_fadvise64.c
index e8a530f..de813ba 100644
--- a/libc/sysdeps/linux/common/posix_fadvise64.c
+++ b/libc/sysdeps/linux/common/posix_fadvise64.c
@@ -8,63 +8,33 @@
* Licensed under the LGPL v2.1, see the file COPYING.LIB in this tarball.
*/
-#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 <fcntl.h>
+#include <bits/wordsize.h>
-#ifdef __UCLIBC_HAS_LFS__
-#ifdef __NR_fadvise64_64
-
-/* 64 bit implementation is cake ... or more like pie ... */
-#if __WORDSIZE == 64
-
-#define __NR_posix_fadvise64 __NR_fadvise64_64
-
-int posix_fadvise64(int fd, __off64_t offset, __off64_t len, int advice)
-{
- if (len != (off_t) len)
- return EOVERFLOW;
- INTERNAL_SYSCALL_DECL (err);
- int ret = INTERNAL_SYSCALL (posix_fadvise64, err, 5, fd,
- __LONG_LONG_PAIR ((long) (offset >> 32),
- (long) offset),
- (off_t) len, advice);
- if (!INTERNAL_SYSCALL_ERROR_P (ret, err))
- return 0;
- return INTERNAL_SYSCALL_ERRNO (ret, err);
-}
+#ifdef __NR_arm_fadvise64_64
+# define __NR_fadvise64_64 __NR_arm_fadvise64_64
+#endif
-/* 32 bit implementation is kind of a pita */
-#elif __WORDSIZE == 32
+#if defined __NR_fadvise64_64 && defined __UCLIBC_HAS_LFS__ && __WORDSIZE == 32
+# include <fcntl.h>
+# include <endian.h>
-int posix_fadvise64(int fd, __off64_t offset, __off64_t len, int advice)
+int posix_fadvise64(int fd, off64_t offset, off64_t len, int advice)
{
INTERNAL_SYSCALL_DECL (err);
+# if defined __powerpc__ || defined __arm__ || defined __xtensa__
+ int ret = INTERNAL_SYSCALL (fadvise64_64, err, 6, fd, advice,
+ __LONG_LONG_PAIR((long)(offset >> 32), (long)offset),
+ __LONG_LONG_PAIR((long)(len >> 32), (long)len));
+# else
int ret = INTERNAL_SYSCALL (fadvise64_64, err, 6, fd,
- __LONG_LONG_PAIR(offset >> 32, offset & 0xffffffff),
- __LONG_LONG_PAIR(len >> 32, len & 0xffffffff),
- advice);
- if (!INTERNAL_SYSCALL_ERROR_P (ret, err))
- return 0;
- return INTERNAL_SYSCALL_ERRNO (ret, err);
+ __LONG_LONG_PAIR((long)(offset >> 32), (long)offset),
+ __LONG_LONG_PAIR((long)(len >> 32), (long)len),
+ advice);
+# endif
+ if (INTERNAL_SYSCALL_ERROR_P (ret, err))
+ return INTERNAL_SYSCALL_ERRNO (ret, err);
+ return 0;
}
-
-#else
-#error your machine is neither 32 bit or 64 bit ... it must be magical
#endif
-
-#elif !defined __NR_fadvise64 && defined __UCLIBC_HAS_STUBS__
-/* This is declared as a strong alias in posix_fadvise.c if __NR_fadvise64
- * is defined.
- */
-int posix_fadvise64(int fd, __off64_t offset, __off64_t len, int advice)
-{
- return ENOSYS;
-}
-#endif /* __NR_fadvise64_64 */
-#endif /* __UCLIBC_HAS_LFS__ */
diff --git a/libc/sysdeps/linux/mips/posix_fadvise.c b/libc/sysdeps/linux/mips/posix_fadvise.c
index 8546d96..b0110bf 100644
--- a/libc/sysdeps/linux/mips/posix_fadvise.c
+++ b/libc/sysdeps/linux/mips/posix_fadvise.c
@@ -8,19 +8,16 @@
* Licensed under the LGPL v2.1, see the file COPYING.LIB in this tarball.
*/
-#include <features.h>
-#include <unistd.h>
-#include <errno.h>
-#include <endian.h>
-#include <stdint.h>
-#include <sys/types.h>
#include <sys/syscall.h>
-#include <fcntl.h>
-int posix_fadvise(int fd, off_t offset, off_t len, int advice)
-{
/* MIPS kernel only has NR_fadvise64 which acts as NR_fadvise64_64 */
#ifdef __NR_fadvise64
+# include <fcntl.h>
+# include <endian.h>
+# include <bits/wordsize.h>
+
+int posix_fadvise(int fd, off_t offset, off_t len, int advice)
+{
INTERNAL_SYSCALL_DECL(err);
# if _MIPS_SIM == _ABIO32
int ret = INTERNAL_SYSCALL(fadvise64, err, 7, fd, 0,
@@ -33,7 +30,9 @@ int posix_fadvise(int fd, off_t offset, off_t len, int advice)
if (INTERNAL_SYSCALL_ERROR_P (ret, err))
return INTERNAL_SYSCALL_ERRNO (ret, err);
return 0;
-#else
- return ENOSYS;
-#endif
}
+# if defined __UCLIBC_HAS_LFS__ && __WORDSIZE == 64
+strong_alias(posix_fadvise,posix_fadvise64)
+# endif
+
+#endif
diff --git a/libc/sysdeps/linux/mips/posix_fadvise64.c b/libc/sysdeps/linux/mips/posix_fadvise64.c
index d9b89d1..f97dab9 100644
--- a/libc/sysdeps/linux/mips/posix_fadvise64.c
+++ b/libc/sysdeps/linux/mips/posix_fadvise64.c
@@ -8,36 +8,28 @@
* Licensed under the LGPL v2.1, see the file COPYING.LIB in this tarball.
*/
-#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 <fcntl.h>
+#include <bits/wordsize.h>
-#ifdef __UCLIBC_HAS_LFS__
+/* MIPS kernel only has NR_fadvise64 which acts as NR_fadvise64_64 */
+#if defined __NR_fadvise64 && defined __UCLIBC_HAS_LFS__ && __WORDSIZE == 32
+# include <fcntl.h>
+# include <endian.h>
-int posix_fadvise64(int fd, __off64_t offset, __off64_t len, int advice)
+int posix_fadvise64(int fd, off64_t offset, off64_t len, int advice)
{
-/* MIPS kernel only has NR_fadvise64 which acts as NR_fadvise64_64 */
-#ifdef __NR_fadvise64
INTERNAL_SYSCALL_DECL(err);
-# if _MIPS_SIM == _MIPS_SIM_ABI32
+# if _MIPS_SIM == _ABIO32
int ret = INTERNAL_SYSCALL(fadvise64, err, 7, fd, 0,
- __LONG_LONG_PAIR ((long) (offset >> 32), (long) offset),
- __LONG_LONG_PAIR ((long) (len >> 32), (long) len),
- advice);
+ __LONG_LONG_PAIR ((long) (offset >> 32), (long) offset),
+ __LONG_LONG_PAIR ((long) (len >> 32), (long) len),
+ advice);
# else /* N32 || N64 */
int ret = INTERNAL_SYSCALL(fadvise64, err, 4, fd, offset, len, advice);
# endif
if (INTERNAL_SYSCALL_ERROR_P (ret, err))
return INTERNAL_SYSCALL_ERRNO (ret, err);
return 0;
-#else
- return ENOSYS;
-#endif
}
-
-#endif /* __UCLIBC_HAS_LFS__ */
+#endif
diff --git a/libc/sysdeps/linux/powerpc/Makefile.arch b/libc/sysdeps/linux/powerpc/Makefile.arch
index cdb35ba..62dbe3b 100644
--- a/libc/sysdeps/linux/powerpc/Makefile.arch
+++ b/libc/sysdeps/linux/powerpc/Makefile.arch
@@ -7,10 +7,6 @@
CSRC := __syscall_error.c pread_write.c ioctl.c
-ifeq ($(UCLIBC_HAS_ADVANCED_REALTIME),y)
-CSRC += posix_fadvise.c posix_fadvise64.c
-endif
-
SSRC := \
__longjmp.S setjmp.S bsd-setjmp.S bsd-_setjmp.S brk.S \
__uClibc_syscall.S syscall.S
diff --git a/libc/sysdeps/linux/powerpc/posix_fadvise.c b/libc/sysdeps/linux/powerpc/posix_fadvise.c
deleted file mode 100644
index ce3574f..0000000
--- a/libc/sysdeps/linux/powerpc/posix_fadvise.c
+++ /dev/null
@@ -1,36 +0,0 @@
-/* vi: set sw=4 ts=4: */
-/*
- * posix_fadvise() for uClibc
- * http://www.opengroup.org/onlinepubs/009695399/functions/posix_fadvise.html
- *
- * Copyright (C) 2000-2006 Erik Andersen <andersen at uclibc.org>
- *
- * Licensed under the LGPL v2.1, see the file COPYING.LIB in this tarball.
- */
-
-#include <sys/syscall.h>
-#include <fcntl.h>
-
-#ifdef __NR_fadvise64
-#define __NR_posix_fadvise __NR_fadvise64
-int posix_fadvise(int fd, off_t offset, off_t len, int advice)
-{
- INTERNAL_SYSCALL_DECL(err);
- int ret = (int) (INTERNAL_SYSCALL(posix_fadvise, err, 6, fd, 0,
- __LONG_LONG_PAIR (offset >> 31, offset), len, advice));
- if (INTERNAL_SYSCALL_ERROR_P (ret, err))
- return INTERNAL_SYSCALL_ERRNO (ret, err);
- return 0;
-}
-
-#if defined __UCLIBC_HAS_LFS__ && (!defined __NR_fadvise64_64 || !defined _syscall6)
-strong_alias(posix_fadvise,posix_fadvise64)
-#endif
-
-#else
-int posix_fadvise(int fd attribute_unused, off_t offset attribute_unused, off_t len attribute_unused, int advice attribute_unused)
-{
-#warning This is not correct as far as SUSv3 is concerned.
- return ENOSYS;
-}
-#endif
diff --git a/libc/sysdeps/linux/powerpc/posix_fadvise64.c b/libc/sysdeps/linux/powerpc/posix_fadvise64.c
deleted file mode 100644
index 2c7d207..0000000
--- a/libc/sysdeps/linux/powerpc/posix_fadvise64.c
+++ /dev/null
@@ -1,69 +0,0 @@
-/* vi: set sw=4 ts=4: */
-/*
- * posix_fadvise64() for uClibc
- * http://www.opengroup.org/onlinepubs/009695399/functions/posix_fadvise.html
- *
- * Copyright (C) 2000-2006 Erik Andersen <andersen at uclibc.org>
- *
- * Licensed under the LGPL v2.1, see the file COPYING.LIB in this tarball.
- */
-
-#include <features.h>
-#include <unistd.h>
-#include <errno.h>
-#include <endian.h>
-#include <stdint.h>
-#include <sys/types.h>
-#include <sys/syscall.h>
-#include <fcntl.h>
-
-#ifdef __UCLIBC_HAS_LFS__
-#ifdef __NR_fadvise64_64
-
-/* 64 bit implementation is cake ... or more like pie ... */
-#if __WORDSIZE == 64
-
-#define __NR_posix_fadvise64 __NR_fadvise64_64
-
-int posix_fadvise64(int fd, __off64_t offset, __off64_t len, int advise)
-{
- if (len != (off_t) len)
- return EOVERFLOW;
- INTERNAL_SYSCALL_DECL (err);
- int ret = INTERNAL_SYSCALL (posix_fadvise64, err, 6, fd, 0,
- __LONG_LONG_PAIR ((long) (offset >> 32), (long) offset),
- (off_t) len, advise);
- if (!INTERNAL_SYSCALL_ERROR_P (ret, err))
- return 0;
- return INTERNAL_SYSCALL_ERRNO (ret, err);
-}
-
-/* 32 bit implementation is kind of a pita */
-#elif __WORDSIZE == 32
-
-int posix_fadvise64(int fd, __off64_t offset, __off64_t len, int advise)
-{
- INTERNAL_SYSCALL_DECL (err);
- int ret = INTERNAL_SYSCALL (fadvise64_64, err, 6, fd, advise,
- __LONG_LONG_PAIR((long) (offset >> 32), (long) offset ),
- __LONG_LONG_PAIR((long) (len >> 32), (long) len));
- if (!INTERNAL_SYSCALL_ERROR_P (ret, err))
- return 0;
- return INTERNAL_SYSCALL_ERRNO (ret, err);
-}
-
-#else
-#error your machine is neither 32 bit or 64 bit ... it must be magical
-#endif
-
-#elif !defined __NR_fadvise64
-/* This is declared as a strong alias in posix_fadvise.c if __NR_fadvise64
- * is defined.
- */
-int posix_fadvise64(int fd, __off64_t offset, __off64_t len, int advise)
-{
-#warning This is not correct as far as SUSv3 is concerned.
- return ENOSYS;
-}
-#endif /* __NR_fadvise64_64 */
-#endif /* __UCLIBC_HAS_LFS__ */
diff --git a/libc/sysdeps/linux/xtensa/Makefile.arch b/libc/sysdeps/linux/xtensa/Makefile.arch
index bf45031..13387f2 100644
--- a/libc/sysdeps/linux/xtensa/Makefile.arch
+++ b/libc/sysdeps/linux/xtensa/Makefile.arch
@@ -8,7 +8,7 @@
CSRC := brk.c fork.c pread_write.c sigaction.c __syscall_error.c
ifeq ($(UCLIBC_HAS_ADVANCED_REALTIME),y)
- CSRC += posix_fadvise.c posix_fadvise64.c
+ CSRC += posix_fadvise.c
endif
SSRC := bsd-_setjmp.S bsd-setjmp.S setjmp.S clone.S \
diff --git a/libc/sysdeps/linux/xtensa/posix_fadvise.c b/libc/sysdeps/linux/xtensa/posix_fadvise.c
index 0fe13a1..94006ec 100644
--- a/libc/sysdeps/linux/xtensa/posix_fadvise.c
+++ b/libc/sysdeps/linux/xtensa/posix_fadvise.c
@@ -9,21 +9,19 @@
*/
#include <sys/syscall.h>
-#include <fcntl.h>
+
+#ifdef __NR_fadvise64_64
+# include <fcntl.h>
+# include <endian.h>
int posix_fadvise (int fd, off_t offset, off_t len, int advice)
{
-#ifdef __NR_fadvise64_64
INTERNAL_SYSCALL_DECL (err);
int ret = INTERNAL_SYSCALL (fadvise64_64, err, 6, fd, advice,
- __LONG_LONG_PAIR ((long) (offset >> 31),
- (long) offset),
- __LONG_LONG_PAIR ((long) (len >> 31),
- (long) len));
- if (!INTERNAL_SYSCALL_ERROR_P (ret, err))
- return 0;
- return INTERNAL_SYSCALL_ERRNO (ret, err);
-#else
- return ENOSYS;
-#endif
+ __LONG_LONG_PAIR ((long) (offset >> 31), (long) offset),
+ __LONG_LONG_PAIR ((long) (len >> 31), (long) len));
+ if (INTERNAL_SYSCALL_ERROR_P (ret, err))
+ return INTERNAL_SYSCALL_ERRNO (ret, err);
+ return 0;
}
+#endif
diff --git a/libc/sysdeps/linux/xtensa/posix_fadvise64.c b/libc/sysdeps/linux/xtensa/posix_fadvise64.c
deleted file mode 100644
index 1fdeeba..0000000
--- a/libc/sysdeps/linux/xtensa/posix_fadvise64.c
+++ /dev/null
@@ -1,39 +0,0 @@
-/* vi: set sw=4 ts=4: */
-/*
- * posix_fadvise64() for Xtensa uClibc
- *
- * Copyright (C) 2000-2006 Erik Andersen <andersen at uclibc.org>
- * Copyright (C) 2007 Tensilica Inc.
- *
- * Licensed under the LGPL v2.1, see the file COPYING.LIB in this tarball.
- */
-
-#include <features.h>
-#include <unistd.h>
-#include <errno.h>
-#include <endian.h>
-#include <stdint.h>
-#include <sys/types.h>
-#include <sys/syscall.h>
-#include <fcntl.h>
-
-#ifdef __UCLIBC_HAS_LFS__
-
-int posix_fadvise64 (int fd, __off64_t offset, __off64_t len, int advice)
-{
-#ifdef __NR_fadvise64_64
- INTERNAL_SYSCALL_DECL (err);
- int ret = INTERNAL_SYSCALL (fadvise64_64, err, 6, fd, advice,
- __LONG_LONG_PAIR ((long) (offset >> 32),
- (long) offset),
- __LONG_LONG_PAIR ((long) (len >> 32),
- (long) len));
- if (!INTERNAL_SYSCALL_ERROR_P (ret, err))
- return 0;
- return INTERNAL_SYSCALL_ERRNO (ret, err);
-#else
- return ENOSYS;
-#endif
-}
-
-#endif /* __UCLIBC_HAS_LFS__ */
--
1.7.3.4
More information about the uClibc-cvs
mailing list