diff options
author | Markos Chandras <markos.chandras@imgtec.com> | 2012-10-11 12:56:48 +0100 |
---|---|---|
committer | Bernhard Reutner-Fischer <rep.dot.nop@gmail.com> | 2013-02-20 13:45:13 +0100 |
commit | d62c716242526c61ddd5f5fe5f5fa88cecb14228 (patch) | |
tree | 47aedd289d3235c52fe4b855354e002aba09a0ee | |
parent | e87a63c1d87904a24fca393a840207cf0451bab9 (diff) |
fcntl: Use fcntl64 is arch does not have the fcntl syscall
Signed-off-by: Markos Chandras <markos.chandras@imgtec.com>
Signed-off-by: Bernhard Reutner-Fischer <rep.dot.nop@gmail.com>
-rw-r--r-- | libc/sysdeps/linux/common/__syscall_fcntl.c | 18 |
1 files changed, 16 insertions, 2 deletions
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 |