diff options
author | Peter S. Mazinger <ps.m@gmx.net> | 2011-04-21 23:03:32 +0200 |
---|---|---|
committer | Bernhard Reutner-Fischer <rep.dot.nop@gmail.com> | 2012-06-15 14:00:41 +0200 |
commit | f74f77b155bd34f75193179d7e4ce63ace771af3 (patch) | |
tree | 0bd63d21e722c1786fc583552464c4bc4d426e33 /libc/sysdeps/linux/common/__syscall_fcntl64.c | |
parent | 4228d2f34cc0b3b70adc16cec499aeef034aece0 (diff) |
fcntl: add cancellation to fcntl64, use cancel.h
fcntl64 missed cancellation.
Guard fcntl64 for 32bit archs.
Reuse as much code as possible in __syscall_fcntl.c.
Provide alias fcntl64 if that syscall is not available.
Signed-off-by: Peter S. Mazinger <ps.m@gmx.net>
Signed-off-by: Bernhard Reutner-Fischer <rep.dot.nop@gmail.com>
Diffstat (limited to 'libc/sysdeps/linux/common/__syscall_fcntl64.c')
-rw-r--r-- | libc/sysdeps/linux/common/__syscall_fcntl64.c | 22 |
1 files changed, 17 insertions, 5 deletions
diff --git a/libc/sysdeps/linux/common/__syscall_fcntl64.c b/libc/sysdeps/linux/common/__syscall_fcntl64.c index 09291e5d7..5174d8ade 100644 --- a/libc/sysdeps/linux/common/__syscall_fcntl64.c +++ b/libc/sysdeps/linux/common/__syscall_fcntl64.c @@ -9,12 +9,16 @@ #include <_lfs_64.h> #include <sys/syscall.h> +#include <bits/wordsize.h> -#ifdef __NR_fcntl64 +#if defined __NR_fcntl64 && __WORDSIZE == 32 # include <stdarg.h> # include <fcntl.h> -# define __NR___syscall_fcntl64 __NR_fcntl64 -static __inline__ _syscall3(int, __syscall_fcntl64, int, fd, int, cmd, long, arg) +# include <cancel.h> + +# define __NR___fcntl64_nocancel __NR_fcntl64 +_syscall3(int, __NC(fcntl64), int, fd, int, cmd, long, arg) + int fcntl64(int fd, int cmd, ...) { long arg; @@ -24,7 +28,15 @@ int fcntl64(int fd, int cmd, ...) arg = va_arg(list, long); va_end(list); - return (__syscall_fcntl64(fd, cmd, arg)); + if (SINGLE_THREAD_P || (cmd != F_SETLKW64)) + return __NC(fcntl64)(fd, cmd, arg); +# ifdef __NEW_THREADS + int oldtype = LIBC_CANCEL_ASYNC(); + int result = __NC(fcntl64)(fd, cmd, arg); + LIBC_CANCEL_RESET(oldtype); + return result; +# endif } -libc_hidden_def(fcntl64) +lt_strong_alias(fcntl64) +lt_libc_hidden(fcntl64) #endif |