From d62c716242526c61ddd5f5fe5f5fa88cecb14228 Mon Sep 17 00:00:00 2001 From: Markos Chandras Date: Thu, 11 Oct 2012 12:56:48 +0100 Subject: fcntl: Use fcntl64 is arch does not have the fcntl syscall Signed-off-by: Markos Chandras Signed-off-by: Bernhard Reutner-Fischer --- libc/sysdeps/linux/common/__syscall_fcntl.c | 18 ++++++++++++++++-- 1 file changed, 16 insertions(+), 2 deletions(-) (limited to 'libc/sysdeps/linux/common/__syscall_fcntl.c') diff --git a/libc/sysdeps/linux/common/__syscall_fcntl.c b/libc/sysdeps/linux/common/__syscall_fcntl.c index d56f4a277..17c67182e 100644 --- a/libc/sysdeps/linux/common/__syscall_fcntl.c +++ b/libc/sysdeps/linux/common/__syscall_fcntl.c @@ -18,15 +18,21 @@ int __NC(fcntl)(int fd, int cmd, long arg) { #if __WORDSIZE == 32 if (cmd == F_GETLK64 || cmd == F_SETLK64 || cmd == F_SETLKW64) { -# if defined __UCLIBC_HAS_LFS__ && defined __NR_fcntl64 - return __NC(fcntl64)(fd, cmd, arg); +# if (defined __UCLIBC_HAS_LFS__ && defined __NR_fcntl64) || !defined __NR_fcntl + return INLINE_SYSCALL(fcntl64, 3, fd, cmd, arg); # else __set_errno(ENOSYS); return -1; # endif } #endif + +#if defined __NR_fcntl return INLINE_SYSCALL(fcntl, 3, fd, cmd, arg); +#else + __set_errno(ENOSYS); + return -1; +#endif } int fcntl(int fd, int cmd, ...) @@ -39,10 +45,18 @@ int fcntl(int fd, int cmd, ...) va_end (ap); if (SINGLE_THREAD_P || (cmd != F_SETLKW && cmd != F_SETLKW64)) +#if defined __NR_fcntl return __NC(fcntl)(fd, cmd, arg); +#else + return INLINE_SYSCALL(fcntl64, 3, fd, cmd, arg); +#endif #ifdef __NEW_THREADS int oldtype = LIBC_CANCEL_ASYNC (); +#if defined __NR_fcntl int result = __NC(fcntl)(fd, cmd, arg); +#else + int result = INLINE_SYSCALL(fcntl64, 3, fd, cmd, arg); +#endif LIBC_CANCEL_RESET (oldtype); return result; #endif -- cgit v1.2.3