diff options
author | Natanael Copa <ncopa@alpinelinux.org> | 2012-07-05 13:49:52 +0000 |
---|---|---|
committer | Natanael Copa <ncopa@alpinelinux.org> | 2012-07-05 13:49:52 +0000 |
commit | d33928ad3fa562f54c1a649926623a96feae1c64 (patch) | |
tree | 6ab6fb47cd94d98d3555f82ef8a8c1195e6d30cb /main/libc0.9.32/0004-add-cancellation-to-generic-pread_write.patch | |
parent | a20bdf6b1652bf2a1133b7be6e16e5f970392120 (diff) | |
download | aports-d33928ad3fa562f54c1a649926623a96feae1c64.tar.bz2 aports-d33928ad3fa562f54c1a649926623a96feae1c64.tar.xz |
main/libc0.9.32: backport the pread/pwrite fixes from master
The previous patch I did broke x86_64.
Diffstat (limited to 'main/libc0.9.32/0004-add-cancellation-to-generic-pread_write.patch')
-rw-r--r-- | main/libc0.9.32/0004-add-cancellation-to-generic-pread_write.patch | 144 |
1 files changed, 144 insertions, 0 deletions
diff --git a/main/libc0.9.32/0004-add-cancellation-to-generic-pread_write.patch b/main/libc0.9.32/0004-add-cancellation-to-generic-pread_write.patch new file mode 100644 index 0000000000..555bc5850f --- /dev/null +++ b/main/libc0.9.32/0004-add-cancellation-to-generic-pread_write.patch @@ -0,0 +1,144 @@ +From 25fae380b721fdb3fe27872dda57d4534d7d78c1 Mon Sep 17 00:00:00 2001 +From: "Peter S. Mazinger" <ps.m@gmx.net> +Date: Fri, 22 Apr 2011 01:25:31 +0200 +Subject: [PATCH 4/6] add cancellation to generic pread_write + +Prepare the file to be used in all arch specific files + +Signed-off-by: Peter S. Mazinger <ps.m@gmx.net> +Signed-off-by: Bernhard Reutner-Fischer <rep.dot.nop@gmail.com> +(cherry picked from commit 61198b43ee8a639544622d0e666b972418c9c383) +--- + libc/sysdeps/linux/common/pread_write.c | 100 ++++++++++++++++---------------- + 1 file changed, 51 insertions(+), 49 deletions(-) + +diff --git a/libc/sysdeps/linux/common/pread_write.c b/libc/sysdeps/linux/common/pread_write.c +index 48fe7dd..3d04bb7 100644 +--- a/libc/sysdeps/linux/common/pread_write.c ++++ b/libc/sysdeps/linux/common/pread_write.c +@@ -15,71 +15,73 @@ + + #include <sys/syscall.h> + #include <unistd.h> +-#include <stdint.h> + #include <endian.h> ++#include <bits/wordsize.h> ++#include <cancel.h> + +-extern __typeof(pread) __libc_pread; +-extern __typeof(pwrite) __libc_pwrite; +-#ifdef __UCLIBC_HAS_LFS__ +-extern __typeof(pread64) __libc_pread64; +-extern __typeof(pwrite64) __libc_pwrite64; +-#endif +- +-#ifdef __NR_pread64 /* Newer kernels renamed but it's the same. */ ++#ifdef __NR_pread64 + # undef __NR_pread + # define __NR_pread __NR_pread64 + #endif ++#ifdef __NR_pwrite64 ++# undef __NR_pwrite ++# define __NR_pwrite __NR_pwrite64 ++#endif + +-#include <bits/kernel_types.h> +- +-#ifdef __NR_pread ++#ifndef MY_PREAD ++# ifdef __NR_pread ++# define __NR___syscall_pread __NR_pread ++static _syscall5(ssize_t, __syscall_pread, int, fd, void *, buf, ++ size_t, count, off_t, offset_hi, off_t, offset_lo) ++# define MY_PREAD(fd, buf, count, offset) __syscall_pread(fd, buf, count, OFF_HI_LO(offset)) ++# define MY_PREAD64(fd, buf, count, offset) __syscall_pread(fd, buf, count, OFF64_HI_LO(offset)) ++#endif + +-# define __NR___syscall_pread __NR_pread +-static __inline__ _syscall5(ssize_t, __syscall_pread, int, fd, void *, buf, +- size_t, count, off_t, offset_hi, off_t, offset_lo) ++#ifndef MY_PWRITE ++# ifdef __NR_pwrite ++# define __NR___syscall_pwrite __NR_pwrite ++static _syscall5(ssize_t, __syscall_pwrite, int, fd, const void *, buf, ++ size_t, count, off_t, offset_hi, off_t, offset_lo) ++# define MY_PWRITE(fd, buf, count, offset) __syscall_pwrite(fd, buf, count, OFF_HI_LO(offset)) ++# define MY_PWRITE64(fd, buf, count, offset) __syscall_pwrite(fd, buf, count, OFF64_HI_LO(offset)) ++#endif + +-ssize_t __libc_pread(int fd, void *buf, size_t count, off_t offset) ++static ssize_t __NC(pread)(int fd, void *buf, size_t count, off_t offset) + { +- return __syscall_pread(fd, buf, count, __LONG_LONG_PAIR(offset >> 31, offset)); ++ return MY_PREAD(fd, buf, count, offset); + } +-weak_alias(__libc_pread,pread) ++CANCELLABLE_SYSCALL(ssize_t, pread, (int fd, void *buf, size_t count, off_t offset), ++ (fd, buf, count, offset)) + +-# ifdef __UCLIBC_HAS_LFS__ +-ssize_t __libc_pread64(int fd, void *buf, size_t count, off64_t offset) ++static ssize_t __NC(pwrite)(int fd, const void *buf, size_t count, off_t offset) + { +- uint32_t low = offset & 0xffffffff; +- uint32_t high = offset >> 32; +- return __syscall_pread(fd, buf, count, __LONG_LONG_PAIR(high, low)); ++ return MY_PWRITE(fd, buf, count, offset); + } +-weak_alias(__libc_pread64,pread64) +-# endif /* __UCLIBC_HAS_LFS__ */ ++CANCELLABLE_SYSCALL(ssize_t, pwrite, (int fd, const void *buf, size_t count, off_t offset), ++ (fd, buf, count, offset)) + +-#endif /* __NR_pread */ +- +-#ifdef __NR_pwrite64 /* Newer kernels renamed but it's the same. */ +-# undef __NR_pwrite +-# define __NR_pwrite __NR_pwrite64 +-#endif +- +-#ifdef __NR_pwrite +- +-# define __NR___syscall_pwrite __NR_pwrite +-static __inline__ _syscall5(ssize_t, __syscall_pwrite, int, fd, const void *, buf, +- size_t, count, off_t, offset_hi, off_t, offset_lo) +- +-ssize_t __libc_pwrite(int fd, const void *buf, size_t count, off_t offset) ++#ifdef __UCLIBC_HAS_LFS__ ++# if __WORDSIZE == 32 ++static ssize_t __NC(pread64)(int fd, void *buf, size_t count, off64_t offset) + { +- return __syscall_pwrite(fd, buf, count, __LONG_LONG_PAIR(offset >> 31, offset)); ++ return MY_PREAD64(fd, buf, count, offset); + } +-weak_alias(__libc_pwrite,pwrite) ++CANCELLABLE_SYSCALL(ssize_t, pread64, (int fd, void *buf, size_t count, off64_t offset), ++ (fd, buf, count, offset)) + +-# ifdef __UCLIBC_HAS_LFS__ +-ssize_t __libc_pwrite64(int fd, const void *buf, size_t count, off64_t offset) ++static ssize_t __NC(pwrite64)(int fd, const void *buf, size_t count, off64_t offset) + { +- uint32_t low = offset & 0xffffffff; +- uint32_t high = offset >> 32; +- return __syscall_pwrite(fd, buf, count, __LONG_LONG_PAIR(high, low)); ++ return MY_PWRITE64(fd, buf, count, offset); + } +-weak_alias(__libc_pwrite64,pwrite64) +-# endif /* __UCLIBC_HAS_LFS__ */ +-#endif /* __NR_pwrite */ ++CANCELLABLE_SYSCALL(ssize_t, pwrite64, (int fd, const void *buf, size_t count, off64_t offset), ++ (fd, buf, count, offset)) ++# else ++# ifdef __LINUXTHREADS_OLD__ ++weak_alias(pread,pread64) ++weak_alias(pwrite,pwrite64) ++# else ++strong_alias_untyped(pread,pread64) ++strong_alias_untyped(pwrite,pwrite64) ++# endif ++# endif ++#endif +-- +1.7.11.1 + |