aboutsummaryrefslogtreecommitdiff
path: root/sysdeps/unix/sysv/linux/i386/fcntl.c
diff options
context:
space:
mode:
Diffstat (limited to 'sysdeps/unix/sysv/linux/i386/fcntl.c')
-rw-r--r--sysdeps/unix/sysv/linux/i386/fcntl.c18
1 files changed, 11 insertions, 7 deletions
diff --git a/sysdeps/unix/sysv/linux/i386/fcntl.c b/sysdeps/unix/sysv/linux/i386/fcntl.c
index 749288d92b..c0ca1257f1 100644
--- a/sysdeps/unix/sysv/linux/i386/fcntl.c
+++ b/sysdeps/unix/sysv/linux/i386/fcntl.c
@@ -28,11 +28,13 @@
#if __ASSUME_FCNTL64 == 0
/* This variable is shared with all files that check for fcntl64. */
int __have_no_fcntl64;
+#endif
-static int
-do_fcntl (int fd, int cmd, void *arg)
+int
+__fcntl_nocancel (int fd, int cmd, void *arg)
{
+#if __ASSUME_FCNTL64 == 0
# ifdef __NR_fcntl64
if (! __have_no_fcntl64)
{
@@ -113,8 +115,10 @@ do_fcntl (int fd, int cmd, void *arg)
return INLINE_SYSCALL (fcntl, 3, fd, cmd, arg);
}
return -1;
+#else
+ return INLINE_SYSCALL (fcntl64, 3, fd, cmd, arg);
+#endif /* !__ASSUME_FCNTL64 */
}
-#endif /* __ASSUME_FCNTL64 */
int
@@ -128,19 +132,19 @@ __libc_fcntl (int fd, int cmd, ...)
va_end (ap);
#if __ASSUME_FCNTL64 > 0
- if (SINGLE_THREAD_P)
+ if (SINGLE_THREAD_P || (cmd != F_SETLKW && cmd != F_SETLKW64))
return INLINE_SYSCALL (fcntl64, 3, fd, cmd, arg);
int oldtype = LIBC_CANCEL_ASYNC ();
int result = INLINE_SYSCALL (fcntl64, 3, fd, cmd, arg);
#else
- if (SINGLE_THREAD_P)
- return do_fcntl (fd, cmd, arg);
+ if (SINGLE_THREAD_P || (cmd != F_SETLKW && cmd != F_SETLKW64))
+ return __fcntl_nocancel (fd, cmd, arg);
int oldtype = LIBC_CANCEL_ASYNC ();
- int result = do_fcntl (fd, cmd, arg);
+ int result = __fcntl_nocancel (fd, cmd, arg);
#endif
LIBC_CANCEL_RESET (oldtype);