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@gmx.net>
Signed-off-by: Bernhard Reutner-Fischer <rep.dot.nop@gmail.com>
endif
ifeq ($(UCLIBC_HAS_ADVANCED_REALTIME),y)
-CSRC += posix_fadvise.c posix_fadvise64.c
+CSRC += posix_fadvise.c
endif
# Is our compiler set up for EABI ?
* 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
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)
-{
- return ENOSYS;
-}
-
#endif
+++ /dev/null
-/* 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@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
*/
#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)
{
int ret;
INTERNAL_SYSCALL_DECL(err);
- 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
+ ret = INTERNAL_SYSCALL(fadvise64, err, 4, fd, offset, len, advice);
+# else
+# ifdef __powerpc__
+ ret = INTERNAL_SYSCALL(fadvise64, err, 6, fd, /*unused*/0,
+# else
+ 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
-
#endif
* 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
-
-#endif /* __NR_fadvise64_64 */
-#endif /* __UCLIBC_HAS_LFS__ */
* 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,
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
* 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
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
+++ /dev/null
-/* 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@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
-
-#endif
+++ /dev/null
-/* 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@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
-
-#endif /* __NR_fadvise64_64 */
-#endif /* __UCLIBC_HAS_LFS__ */
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 \
*/
#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
+++ /dev/null
-/* vi: set sw=4 ts=4: */
-/*
- * posix_fadvise64() for Xtensa uClibc
- *
- * Copyright (C) 2000-2006 Erik Andersen <andersen@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__ */