diff options
Diffstat (limited to 'sysdeps/unix/sysv/linux/pread.c')
-rw-r--r-- | sysdeps/unix/sysv/linux/pread.c | 30 |
1 files changed, 23 insertions, 7 deletions
diff --git a/sysdeps/unix/sysv/linux/pread.c b/sysdeps/unix/sysv/linux/pread.c index 31abf7e886..a506c17e95 100644 --- a/sysdeps/unix/sysv/linux/pread.c +++ b/sysdeps/unix/sysv/linux/pread.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> @@ -47,12 +47,8 @@ static ssize_t __emulate_pread (int fd, void *buf, size_t count, # endif -ssize_t -__libc_pread (fd, buf, count, offset) - int fd; - void *buf; - size_t count; - off_t offset; +static ssize_t +do_pread (int fd, void *buf, size_t count, off_t offset) { ssize_t result; @@ -69,6 +65,26 @@ __libc_pread (fd, buf, count, offset) return result; } + +ssize_t +__libc_pread (fd, buf, count, offset) + int fd; + void *buf; + size_t count; + off_t offset; +{ + if (SINGLE_THREAD_P) + return do_pread (fd, buf, count, offset); + + int oldtype = LIBC_CANCEL_ASYNC (); + + ssize_t result = do_pread (fd, buf, count, offset); + + LIBC_CANCEL_RESET (oldtype); + + return result; +} + strong_alias (__libc_pread, __pread) weak_alias (__libc_pread, pread) |