|
@@ -10,82 +10,47 @@
|
|
|
|
|
|
#include <sys/syscall.h>
|
|
#include <sys/syscall.h>
|
|
#include <stdarg.h>
|
|
#include <stdarg.h>
|
|
-#ifdef __UCLIBC_HAS_THREADS_NATIVE__
|
|
+#include <cancel.h> /* Must come before <fcntl.h>. */
|
|
-#include <sysdep-cancel.h> /* Must come before <fcntl.h>. */
|
|
|
|
-#endif
|
|
|
|
#include <fcntl.h>
|
|
#include <fcntl.h>
|
|
#include <bits/wordsize.h>
|
|
#include <bits/wordsize.h>
|
|
|
|
|
|
-extern __typeof(fcntl) __libc_fcntl;
|
|
+int __NC(fcntl)(int fd, int cmd, long arg)
|
|
-libc_hidden_proto(__libc_fcntl)
|
|
|
|
-
|
|
|
|
-int __fcntl_nocancel (int fd, int cmd, ...)
|
|
|
|
{
|
|
{
|
|
- va_list ap;
|
|
+#if __WORDSIZE == 32
|
|
- void *arg;
|
|
|
|
-
|
|
|
|
- va_start (ap, cmd);
|
|
|
|
- arg = va_arg (ap, void *);
|
|
|
|
- va_end (ap);
|
|
|
|
-
|
|
|
|
-# if __WORDSIZE == 32
|
|
|
|
if (cmd == F_GETLK64 || cmd == F_SETLK64 || cmd == F_SETLKW64) {
|
|
if (cmd == F_GETLK64 || cmd == F_SETLK64 || cmd == F_SETLKW64) {
|
|
-# if defined __UCLIBC_HAS_LFS__ && defined __NR_fcntl64
|
|
+# if defined __UCLIBC_HAS_LFS__ && defined __NR_fcntl64
|
|
- return INLINE_SYSCALL (fcntl64, 3, fd, cmd, arg);
|
|
+ return __NC(fcntl64)(fd, cmd, arg);
|
|
-# else
|
|
+# else
|
|
__set_errno(ENOSYS);
|
|
__set_errno(ENOSYS);
|
|
return -1;
|
|
return -1;
|
|
-# endif
|
|
|
|
- }
|
|
|
|
# endif
|
|
# endif
|
|
- return INLINE_SYSCALL (fcntl, 3, fd, cmd, arg);
|
|
+ }
|
|
|
|
+#endif
|
|
|
|
+ return INLINE_SYSCALL(fcntl, 3, fd, cmd, arg);
|
|
}
|
|
}
|
|
-libc_hidden_def(__fcntl_nocancel)
|
|
|
|
|
|
|
|
-int __libc_fcntl (int fd, int cmd, ...)
|
|
+int fcntl(int fd, int cmd, ...)
|
|
{
|
|
{
|
|
va_list ap;
|
|
va_list ap;
|
|
- void *arg;
|
|
+ long arg;
|
|
|
|
|
|
va_start (ap, cmd);
|
|
va_start (ap, cmd);
|
|
- arg = va_arg (ap, void *);
|
|
+ arg = va_arg (ap, long);
|
|
va_end (ap);
|
|
va_end (ap);
|
|
|
|
|
|
-#ifdef __UCLIBC_HAS_THREADS_NATIVE__
|
|
|
|
if (SINGLE_THREAD_P || (cmd != F_SETLKW && cmd != F_SETLKW64))
|
|
if (SINGLE_THREAD_P || (cmd != F_SETLKW && cmd != F_SETLKW64))
|
|
-# if defined __UCLIBC_HAS_LFS__ && defined __NR_fcntl64
|
|
+ return __NC(fcntl)(fd, cmd, arg);
|
|
- return INLINE_SYSCALL (fcntl64, 3, fd, cmd, arg);
|
|
+#ifdef __NEW_THREADS
|
|
-# else
|
|
|
|
- return INLINE_SYSCALL (fcntl, 3, fd, cmd, arg);
|
|
|
|
-# endif
|
|
|
|
-
|
|
|
|
int oldtype = LIBC_CANCEL_ASYNC ();
|
|
int oldtype = LIBC_CANCEL_ASYNC ();
|
|
-
|
|
+ int result = __NC(fcntl)(fd, cmd, arg);
|
|
-# 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);
|
|
LIBC_CANCEL_RESET (oldtype);
|
|
-
|
|
|
|
return result;
|
|
return result;
|
|
-#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);
|
|
|
|
#endif
|
|
#endif
|
|
}
|
|
}
|
|
-libc_hidden_def(__libc_fcntl)
|
|
+lt_strong_alias(fcntl)
|
|
-
|
|
+lt_libc_hidden(fcntl)
|
|
-libc_hidden_proto(fcntl)
|
|
+#if defined __UCLIBC_HAS_LFS__ && !defined __NR_fcntl64 && __WORDSIZE == 32
|
|
-weak_alias(__libc_fcntl,fcntl)
|
|
+strong_alias_untyped(fcntl,fcntl64)
|
|
-libc_hidden_weak(fcntl)
|
|
+lt_strong_alias(fcntl64)
|
|
|
|
+lt_libc_hidden(fcntl64)
|
|
|
|
+#endif
|