Signed-off-by: Jonas Bonn <[email protected]>
---
 libc/sysdeps/linux/common/__syscall_fcntl.c   |   49 +++++++++++++++++--------
 libc/sysdeps/linux/common/__syscall_fcntl64.c |    6 +++
 2 files changed, 39 insertions(+), 16 deletions(-)

diff --git a/libc/sysdeps/linux/common/__syscall_fcntl.c 
b/libc/sysdeps/linux/common/__syscall_fcntl.c
index 6d4c339..cb453e6 100644
--- a/libc/sysdeps/linux/common/__syscall_fcntl.c
+++ b/libc/sysdeps/linux/common/__syscall_fcntl.c
@@ -19,6 +19,36 @@
 extern __typeof(fcntl) __libc_fcntl;
 libc_hidden_proto(__libc_fcntl)
 
+#ifdef __NR_fcntl64
+
+int __libc_fcntl (int fd, int cmd, ...)
+{
+       va_list ap;
+       void *arg;
+
+       va_start (ap, cmd);
+       arg = va_arg (ap, void *);
+       va_end (ap);
+
+       return fcntl64(fd, cmd, arg);
+}
+libc_hidden_def(__libc_fcntl)
+
+int __fcntl_nocancel (int fd, int cmd, ...)
+{
+       va_list ap;
+       void *arg;
+
+       va_start (ap, cmd);
+       arg = va_arg (ap, void *);
+       va_end (ap);
+
+       return fcntl64(fd, cmd, arg);
+}
+libc_hidden_def(__fcntl_nocancel)
+
+#else
+
 int __fcntl_nocancel (int fd, int cmd, ...)
 {
        va_list ap;
@@ -30,12 +60,8 @@ int __fcntl_nocancel (int fd, int cmd, ...)
 
 # if __WORDSIZE == 32
        if (cmd == F_GETLK64 || cmd == F_SETLK64 || cmd == F_SETLKW64) {
-#  if defined __UCLIBC_HAS_LFS__ && defined __NR_fcntl64
-               return INLINE_SYSCALL (fcntl64, 3, fd, cmd, arg);
-#  else
                __set_errno(ENOSYS);
                return -1;
-#  endif
        }
 # endif
        return INLINE_SYSCALL (fcntl, 3, fd, cmd, arg);
@@ -53,19 +79,11 @@ int __libc_fcntl (int fd, int cmd, ...)
 
 #ifdef __UCLIBC_HAS_THREADS_NATIVE__
        if (SINGLE_THREAD_P || (cmd != F_SETLKW && cmd != F_SETLKW64))
-# if defined __UCLIBC_HAS_LFS__ && defined __NR_fcntl64
-               return INLINE_SYSCALL (fcntl64, 3, fd, cmd, arg);
-# else
                return INLINE_SYSCALL (fcntl, 3, fd, cmd, arg);
-# endif
 
        int oldtype = LIBC_CANCEL_ASYNC ();
 
-# if defined __UCLIBC_HAS_LFS__ && defined __NR_fcntl64
-       int result = INLINE_SYSCALL (fcntl64, 3, fd, cmd, arg);
-# else
        int result = INLINE_SYSCALL (fcntl, 3, fd, cmd, arg);
-# endif
 
        LIBC_CANCEL_RESET (oldtype);
 
@@ -73,12 +91,8 @@ int __libc_fcntl (int fd, int cmd, ...)
 #else
 # if __WORDSIZE == 32
        if (cmd == F_GETLK64 || cmd == F_SETLK64 || cmd == F_SETLKW64) {
-#  if defined __UCLIBC_HAS_LFS__ && defined __NR_fcntl64
-               return INLINE_SYSCALL (fcntl64, 3, fd, cmd, arg);
-#  else
                __set_errno(ENOSYS);
                return -1;
-#  endif
        }
 # endif
        return INLINE_SYSCALL (fcntl, 3, fd, cmd, arg);
@@ -86,6 +100,9 @@ int __libc_fcntl (int fd, int cmd, ...)
 }
 libc_hidden_def(__libc_fcntl)
 
+#endif
+
 libc_hidden_proto(fcntl)
 weak_alias(__libc_fcntl,fcntl)
 libc_hidden_weak(fcntl)
+
diff --git a/libc/sysdeps/linux/common/__syscall_fcntl64.c 
b/libc/sysdeps/linux/common/__syscall_fcntl64.c
index e8782e9..17fd1de 100644
--- a/libc/sysdeps/linux/common/__syscall_fcntl64.c
+++ b/libc/sysdeps/linux/common/__syscall_fcntl64.c
@@ -27,4 +27,10 @@ int fcntl64(int fd, int cmd, ...)
        return (__syscall_fcntl64(fd, cmd, arg));
 }
 libc_hidden_def(fcntl64)
+
+/*
+#if ! defined __NR_fcntl
+strong_alias(fcntl64,fcntl)
+#endif
+*/
 #endif
-- 
1.7.5.4

_______________________________________________
uClibc mailing list
[email protected]
http://lists.busybox.net/mailman/listinfo/uclibc

Reply via email to