summaryrefslogtreecommitdiff
path: root/sysdeps/unix/sysv/linux/pwrite.c
diff options
context:
space:
mode:
Diffstat (limited to 'sysdeps/unix/sysv/linux/pwrite.c')
-rw-r--r--sysdeps/unix/sysv/linux/pwrite.c35
1 files changed, 26 insertions, 9 deletions
diff --git a/sysdeps/unix/sysv/linux/pwrite.c b/sysdeps/unix/sysv/linux/pwrite.c
index 13bbc76b3e..af4ac362b8 100644
--- a/sysdeps/unix/sysv/linux/pwrite.c
+++ b/sysdeps/unix/sysv/linux/pwrite.c
@@ -22,7 +22,7 @@
#include <endian.h>
#include <unistd.h>
-#include <sysdep.h>
+#include <sysdep-cancel.h>
#include <sys/syscall.h>
#include <bp-checks.h>
@@ -38,8 +38,9 @@
#if defined __NR_pwrite || __ASSUME_PWRITE_SYSCALL > 0
/* The order of hi, lo depends on endianness. */
-extern ssize_t __syscall_pwrite (int fd, const void *__unbounded buf, size_t count,
- off_t offset_hi, off_t offset_lo);
+extern ssize_t __syscall_pwrite (int fd, const void *__unbounded buf,
+ size_t count, off_t offset_hi,
+ off_t offset_lo);
# if __ASSUME_PWRITE_SYSCALL == 0
static ssize_t __emulate_pwrite (int fd, const void *buf, size_t count,
@@ -47,12 +48,8 @@ static ssize_t __emulate_pwrite (int fd, const void *buf, size_t count,
# endif
-ssize_t
-__libc_pwrite (fd, buf, count, offset)
- int fd;
- const void *buf;
- size_t count;
- off_t offset;
+static ssize_t
+do_pwrite (int fd, const void *buf, size_t count, off_t offset)
{
ssize_t result;
@@ -69,6 +66,26 @@ __libc_pwrite (fd, buf, count, offset)
return result;
}
+
+ssize_t
+__libc_pwrite (fd, buf, count, offset)
+ int fd;
+ const void *buf;
+ size_t count;
+ off_t offset;
+{
+ if (SINGLE_THREAD_P)
+ return do_pwrite (fd, buf, count, offset);
+
+ int oldtype = LIBC_CANCEL_ASYNC ();
+
+ ssize_t result = do_pwrite (fd, buf, count, offset);
+
+ LIBC_CANCEL_RESET (oldtype);
+
+ return result;
+}
+
strong_alias (__libc_pwrite, __pwrite)
weak_alias (__libc_pwrite, pwrite)