aboutsummaryrefslogtreecommitdiffstats
path: root/main/libc0.9.32
diff options
context:
space:
mode:
authorNatanael Copa <ncopa@alpinelinux.org>2012-07-05 13:49:52 +0000
committerNatanael Copa <ncopa@alpinelinux.org>2012-07-05 13:49:52 +0000
commitd33928ad3fa562f54c1a649926623a96feae1c64 (patch)
tree6ab6fb47cd94d98d3555f82ef8a8c1195e6d30cb /main/libc0.9.32
parenta20bdf6b1652bf2a1133b7be6e16e5f970392120 (diff)
downloadaports-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')
-rw-r--r--main/libc0.9.32/0001-cancel.h-add-generic-file-to-ease-cancellation-suppo.patch139
-rw-r--r--main/libc0.9.32/0002-pread-pwrite-handle-renamed-syscalls-in-common-ppc-x.patch113
-rw-r--r--main/libc0.9.32/0003-pread-pwrite-drop-fallback-funcs.patch385
-rw-r--r--main/libc0.9.32/0004-add-cancellation-to-generic-pread_write.patch144
-rw-r--r--main/libc0.9.32/0005-pread_write.c-make-all-archs-use-common-code.patch671
-rw-r--r--main/libc0.9.32/0006-endian.h-add-some-handy-macros-to-be-used-in-syscall.patch37
-rw-r--r--main/libc0.9.32/APKBUILD20
-rw-r--r--main/libc0.9.32/pread.patch207
8 files changed, 1503 insertions, 213 deletions
diff --git a/main/libc0.9.32/0001-cancel.h-add-generic-file-to-ease-cancellation-suppo.patch b/main/libc0.9.32/0001-cancel.h-add-generic-file-to-ease-cancellation-suppo.patch
new file mode 100644
index 0000000000..59faf075ee
--- /dev/null
+++ b/main/libc0.9.32/0001-cancel.h-add-generic-file-to-ease-cancellation-suppo.patch
@@ -0,0 +1,139 @@
+From b26db0813ca2aab8882535caa9d0a6c8671e9bbc Mon Sep 17 00:00:00 2001
+From: "Peter S. Mazinger" <ps.m@gmx.net>
+Date: Thu, 21 Apr 2011 21:19:39 +0200
+Subject: [PATCH 1/6] cancel.h: add generic file to ease cancellation support
+
+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 9f68f0cbf8c8eea6a7f9e195e4617bbaa808d7c6)
+
+Conflicts:
+ Makefile.in
+---
+ Makefile.in | 1 +
+ include/cancel.h | 101 +++++++++++++++++++++++++++++++++++++++++++++++++++++++
+ 2 files changed, 102 insertions(+)
+ create mode 100644 include/cancel.h
+
+diff --git a/Makefile.in b/Makefile.in
+index 9ba590d..e81926d 100644
+--- a/Makefile.in
++++ b/Makefile.in
+@@ -210,6 +210,7 @@ $(top_builddir)extra/scripts/unifdef: $(top_srcdir)extra/scripts/unifdef.c
+ # a "y" here means the feature is enabled and so we should *not* rm it.
+ # if the option expands to nothing though, we can punt the headers.
+ HEADERS_RM- := \
++ cancel.h \
+ dl-osinfo.h \
+ hp-timing.h \
+ _lfs_64.h \
+diff --git a/include/cancel.h b/include/cancel.h
+new file mode 100644
+index 0000000..ac6f6b6
+--- /dev/null
++++ b/include/cancel.h
+@@ -0,0 +1,101 @@
++/* vi: set sw=4 ts=4: */
++/*
++ * Copyright (C) 2000-2011 Erik Andersen <andersen@uclibc.org>
++ *
++ * Licensed under the LGPL v2.1, see the file COPYING.LIB in this tarball.
++ */
++
++#ifndef _CANCEL_H
++#define _CANCEL_H
++
++/*
++ * Usage of this header:
++ * 1. define a static or hidden function __NC(NAME) - expands to __NAME_nocancel
++ * 2. if it is hidden, add the prototype to the appropiate header where NAME has
++ * it's prototype (guarded by _LIBC)
++ * 3. add a CANCELLABLE_SYSCALL(...) line at the end, this will create the function
++ * NAME (as weak) with enabled cancellation for NPTL (and later for new LT), for
++ * LT_OLD it will also create a strong_alias to __libc_NAME to be used in libpthread
++ * 4. if you need libc_hidden_(weak|def) line, use instead lt_libc_hidden, this will
++ * take care of the correct type, weak or strong depending on the THREADS type
++ * 5. If the implementation can't be done using CANCELLABLE_SYSCALL (like for fcntl)
++ * you need to manually add lt_strong_alias() line too, to optionally create the
++ * __libc_NAME alias
++ * 6. if functions are needed to implement __NC(NAME), that themselves are cancellable,
++ * decide how the cancellation should be solved, two variants are possible:
++ * a. use the other function as __NC(FUNC), this way you access the non-cancellable
++ * variant and provide by CANCELLABLE_SYSCALL(...) the dedicated cancellation for NAME.
++ * be aware, that for this case __NC(FUNC) has to be hidden (not static)
++ * b. use the other function with it's name (FUNC) and add LIBC_CANCEL_HANDLED(); at
++ * the end of file with a comment telling us which function took care of the cancellation
++ * Note: LIBC_CANCEL_HANDLED() is noop on uClibc, glibc uses it only for tests, we use
++ * it only for "documentation".
++ *
++ * For now the use of this file is limited to libc, will expand later to support libpthread
++ * and librt as well.
++ */
++
++#include <features.h>
++
++#ifndef NOT_IN_libc
++
++#define __NC(name) _NC(name)
++#define _NC(name) __##name##_nocancel
++
++#define __NC_OLD(name) _NC_OLD(name)
++#define _NC_OLD(name) __libc_##name
++
++#define __NC_PROTO(name) extern __typeof(name) __NC(name) attribute_hidden;
++#define __NC_OLD_PROTO(name) extern __typeof(name) __NC_OLD(name);
++
++#if defined __UCLIBC_HAS_THREADS__ && !defined __LINUXTHREADS_OLD__
++# define __NEW_THREADS 1
++#else
++# define SINGLE_THREAD_P 1
++#endif
++
++#ifdef __NEW_THREADS
++# include <sysdep-cancel.h>
++
++# define CANCELLABLE_SYSCALL(res_type, name, param_list, params) \
++res_type weak_function name param_list \
++{ \
++ if (SINGLE_THREAD_P) \
++ return __NC(name) params; \
++ int oldtype = LIBC_CANCEL_ASYNC(); \
++ res_type result = __NC(name) params; \
++ LIBC_CANCEL_RESET(oldtype); \
++ return result; \
++}
++
++# define lt_strong_alias(name)
++# define lt_libc_hidden(name) libc_hidden_def(name)
++
++#elif defined __LINUXTHREADS_OLD__
++
++# define CANCELLABLE_SYSCALL(res_type, name, param_list, params) \
++weak_alias(__NC(name),name) \
++lt_strong_alias(name)
++
++# define lt_strong_alias(name) \
++__NC_OLD_PROTO(name) \
++strong_alias(name,__NC_OLD(name))
++# define lt_libc_hidden(name) libc_hidden_weak(name)
++
++#else
++
++# define CANCELLABLE_SYSCALL(res_type, name, param_list, params) \
++strong_alias(__NC(name),name)
++
++# define lt_strong_alias(name)
++# define lt_libc_hidden(name) libc_hidden_def(name)
++
++#endif
++
++/* disable it, useless, glibc uses it only for tests */
++# undef LIBC_CANCEL_HANDLED
++# define LIBC_CANCEL_HANDLED()
++
++#endif /* NOT_IN_libc */
++
++#endif
+--
+1.7.11.1
+
diff --git a/main/libc0.9.32/0002-pread-pwrite-handle-renamed-syscalls-in-common-ppc-x.patch b/main/libc0.9.32/0002-pread-pwrite-handle-renamed-syscalls-in-common-ppc-x.patch
new file mode 100644
index 0000000000..c11fcc55fd
--- /dev/null
+++ b/main/libc0.9.32/0002-pread-pwrite-handle-renamed-syscalls-in-common-ppc-x.patch
@@ -0,0 +1,113 @@
+From 1bdc1ab2938ddc824c01b9b4487ea6a73e4216cd Mon Sep 17 00:00:00 2001
+From: Mike Frysinger <vapier@gentoo.org>
+Date: Wed, 30 May 2012 01:15:03 -0400
+Subject: [PATCH 2/6] pread/pwrite: handle renamed syscalls in
+ common/ppc/xtensa code
+
+Some arches got this fix, but many did not. So copy the ifdef logic to
+the ones that missed it to fix behavior in linux-2.6+.
+
+URL: https://bugs.busybox.net/show_bug.cgi?id=5258
+Reported-by: David Laight <david.laight@aculab.com>
+Signed-off-by: Mike Frysinger <vapier@gentoo.org>
+(cherry picked from commit 52fa45da0f86651b70608a58914f3aece7fdfed5)
+---
+ libc/sysdeps/linux/common/pread_write.c | 10 ++++++++++
+ libc/sysdeps/linux/powerpc/pread_write.c | 13 +++++++++++++
+ libc/sysdeps/linux/xtensa/pread_write.c | 14 ++++++++++++++
+ 3 files changed, 37 insertions(+)
+
+diff --git a/libc/sysdeps/linux/common/pread_write.c b/libc/sysdeps/linux/common/pread_write.c
+index 88e6957..089ee93 100644
+--- a/libc/sysdeps/linux/common/pread_write.c
++++ b/libc/sysdeps/linux/common/pread_write.c
+@@ -25,6 +25,11 @@ extern __typeof(pread64) __libc_pread64;
+ extern __typeof(pwrite64) __libc_pwrite64;
+ #endif
+
++#ifdef __NR_pread64 /* Newer kernels renamed but it's the same. */
++# undef __NR_pread
++# define __NR_pread __NR_pread64
++#endif
++
+ #include <bits/kernel_types.h>
+
+ #ifdef __NR_pread
+@@ -51,6 +56,11 @@ weak_alias(__libc_pread64,pread64)
+
+ #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
+diff --git a/libc/sysdeps/linux/powerpc/pread_write.c b/libc/sysdeps/linux/powerpc/pread_write.c
+index 7f988d3..23f256f 100644
+--- a/libc/sysdeps/linux/powerpc/pread_write.c
++++ b/libc/sysdeps/linux/powerpc/pread_write.c
+@@ -20,6 +20,13 @@
+ # define off64_t off_t
+ #endif
+
++#ifdef __NR_pread64 /* Newer kernels renamed but it's the same. */
++# ifdef __NR_pread
++# error "__NR_pread and __NR_pread64 both defined???"
++# endif
++# define __NR_pread __NR_pread64
++#endif
++
+ #ifdef __NR_pread
+ extern __typeof(pread) __libc_pread;
+ # define __NR___syscall_pread __NR_pread
+@@ -42,6 +49,12 @@ weak_alias(__libc_pread64,pread64)
+ # endif /* __UCLIBC_HAS_LFS__ */
+ #endif /* __NR_pread */
+
++#ifdef __NR_pwrite64 /* Newer kernels renamed but it's the same. */
++# ifdef __NR_pwrite
++# error "__NR_pwrite and __NR_pwrite64 both defined???"
++# endif
++# define __NR_pwrite __NR_pwrite64
++#endif
+
+ #ifdef __NR_pwrite
+ extern __typeof(pwrite) __libc_pwrite;
+diff --git a/libc/sysdeps/linux/xtensa/pread_write.c b/libc/sysdeps/linux/xtensa/pread_write.c
+index 71ba22b..bcf7dee 100644
+--- a/libc/sysdeps/linux/xtensa/pread_write.c
++++ b/libc/sysdeps/linux/xtensa/pread_write.c
+@@ -27,6 +27,13 @@ extern __typeof(pwrite64) __libc_pwrite64;
+
+ #include <bits/kernel_types.h>
+
++#ifdef __NR_pread64 /* Newer kernels renamed but it's the same. */
++# ifdef __NR_pread
++# error "__NR_pread and __NR_pread64 both defined???"
++# endif
++# define __NR_pread __NR_pread64
++#endif
++
+ #ifdef __NR_pread
+
+ # define __NR___syscall_pread __NR_pread
+@@ -52,6 +59,13 @@ weak_alias(__libc_pread64,pread64)
+
+ #endif /* __NR_pread */
+
++#ifdef __NR_pwrite64 /* Newer kernels renamed but it's the same. */
++# ifdef __NR_pwrite
++# error "__NR_pwrite and __NR_pwrite64 both defined???"
++# endif
++# define __NR_pwrite __NR_pwrite64
++#endif
++
+ #ifdef __NR_pwrite
+
+ # define __NR___syscall_pwrite __NR_pwrite
+--
+1.7.11.1
+
diff --git a/main/libc0.9.32/0003-pread-pwrite-drop-fallback-funcs.patch b/main/libc0.9.32/0003-pread-pwrite-drop-fallback-funcs.patch
new file mode 100644
index 0000000000..0f4091ffe9
--- /dev/null
+++ b/main/libc0.9.32/0003-pread-pwrite-drop-fallback-funcs.patch
@@ -0,0 +1,385 @@
+From eb5db626afa3dccbd5d2cb0f4fbec6a1606dcfff Mon Sep 17 00:00:00 2001
+From: Mike Frysinger <vapier@gentoo.org>
+Date: Wed, 30 May 2012 01:40:33 -0400
+Subject: [PATCH 3/6] pread/pwrite: drop fallback funcs
+
+Linux has provided these functions since the 2.1.x era, so no need to
+keep these around. We'd rather find out when things are missing (and
+fix that) than fall back to the unsafe hacks.
+
+Signed-off-by: Mike Frysinger <vapier@gentoo.org>
+(cherry picked from commit 80c9bfc4668e2370b3434a801dc266f336265832)
+---
+ libc/sysdeps/linux/common/pread_write.c | 112 -----------------------------
+ libc/sysdeps/linux/powerpc/pread_write.c | 117 -------------------------------
+ libc/sysdeps/linux/xtensa/pread_write.c | 112 -----------------------------
+ 3 files changed, 341 deletions(-)
+
+diff --git a/libc/sysdeps/linux/common/pread_write.c b/libc/sysdeps/linux/common/pread_write.c
+index 089ee93..48fe7dd 100644
+--- a/libc/sysdeps/linux/common/pread_write.c
++++ b/libc/sysdeps/linux/common/pread_write.c
+@@ -83,115 +83,3 @@ ssize_t __libc_pwrite64(int fd, const void *buf, size_t count, off64_t offset)
+ weak_alias(__libc_pwrite64,pwrite64)
+ # endif /* __UCLIBC_HAS_LFS__ */
+ #endif /* __NR_pwrite */
+-
+-#if ! defined __NR_pread || ! defined __NR_pwrite
+-
+-static ssize_t __fake_pread_write(int fd, void *buf,
+- size_t count, off_t offset, int do_pwrite)
+-{
+- int save_errno;
+- ssize_t result;
+- off_t old_offset;
+-
+- /* Since we must not change the file pointer preserve the
+- * value so that we can restore it later. */
+- if ((old_offset=lseek(fd, 0, SEEK_CUR)) == (off_t) -1)
+- return -1;
+-
+- /* Set to wanted position. */
+- if (lseek(fd, offset, SEEK_SET) == (off_t) -1)
+- return -1;
+-
+- if (do_pwrite == 1) {
+- /* Write the data. */
+- result = write(fd, buf, count);
+- } else {
+- /* Read the data. */
+- result = read(fd, buf, count);
+- }
+-
+- /* Now we have to restore the position. If this fails we
+- * have to return this as an error. */
+- save_errno = errno;
+- if (lseek(fd, old_offset, SEEK_SET) == (off_t) -1)
+- {
+- if (result == -1)
+- __set_errno(save_errno);
+- return -1;
+- }
+- __set_errno(save_errno);
+- return(result);
+-}
+-
+-# ifdef __UCLIBC_HAS_LFS__
+-
+-static ssize_t __fake_pread_write64(int fd, void *buf,
+- size_t count, off64_t offset, int do_pwrite)
+-{
+- int save_errno;
+- ssize_t result;
+- off64_t old_offset;
+-
+- /* Since we must not change the file pointer preserve the
+- * value so that we can restore it later. */
+- if ((old_offset=lseek64(fd, 0, SEEK_CUR)) == (off64_t) -1)
+- return -1;
+-
+- /* Set to wanted position. */
+- if (lseek64(fd, offset, SEEK_SET) == (off64_t) -1)
+- return -1;
+-
+- if (do_pwrite == 1) {
+- /* Write the data. */
+- result = write(fd, buf, count);
+- } else {
+- /* Read the data. */
+- result = read(fd, buf, count);
+- }
+-
+- /* Now we have to restore the position. */
+- save_errno = errno;
+- if (lseek64(fd, old_offset, SEEK_SET) == (off64_t) -1) {
+- if (result == -1)
+- __set_errno (save_errno);
+- return -1;
+- }
+- __set_errno (save_errno);
+- return result;
+-}
+-# endif /* __UCLIBC_HAS_LFS__ */
+-#endif /* ! defined __NR_pread || ! defined __NR_pwrite */
+-
+-#ifndef __NR_pread
+-ssize_t __libc_pread(int fd, void *buf, size_t count, off_t offset)
+-{
+- return __fake_pread_write(fd, buf, count, offset, 0);
+-}
+-weak_alias(__libc_pread,pread)
+-
+-# ifdef __UCLIBC_HAS_LFS__
+-ssize_t __libc_pread64(int fd, void *buf, size_t count, off64_t offset)
+-{
+- return __fake_pread_write64(fd, buf, count, offset, 0);
+-}
+-weak_alias(__libc_pread64,pread64)
+-# endif /* __UCLIBC_HAS_LFS__ */
+-#endif /* ! __NR_pread */
+-
+-#ifndef __NR_pwrite
+-ssize_t __libc_pwrite(int fd, const void *buf, size_t count, off_t offset)
+-{
+- /* we won't actually be modifying the buffer,
+- *just cast it to get rid of warnings */
+- return __fake_pread_write(fd, (void*)buf, count, offset, 1);
+-}
+-weak_alias(__libc_pwrite,pwrite)
+-
+-# ifdef __UCLIBC_HAS_LFS__
+-ssize_t __libc_pwrite64(int fd, const void *buf, size_t count, off64_t offset)
+-{
+- return __fake_pread_write64(fd, (void*)buf, count, offset, 1);
+-}
+-weak_alias(__libc_pwrite64,pwrite64)
+-# endif /* __UCLIBC_HAS_LFS__ */
+-#endif /* ! __NR_pwrite */
+diff --git a/libc/sysdeps/linux/powerpc/pread_write.c b/libc/sysdeps/linux/powerpc/pread_write.c
+index 23f256f..92a184c 100644
+--- a/libc/sysdeps/linux/powerpc/pread_write.c
++++ b/libc/sysdeps/linux/powerpc/pread_write.c
+@@ -77,120 +77,3 @@ ssize_t __libc_pwrite64(int fd, const void *buf, size_t count, off64_t offset)
+ weak_alias(__libc_pwrite64,pwrite64)
+ # endif /* __UCLIBC_HAS_LFS__ */
+ #endif /* __NR_pwrite */
+-
+-
+-
+-#if ! defined __NR_pread || ! defined __NR_pwrite
+-
+-static ssize_t __fake_pread_write(int fd, void *buf,
+- size_t count, off_t offset, int do_pwrite)
+-{
+- int save_errno;
+- ssize_t result;
+- off_t old_offset;
+-
+- /* Since we must not change the file pointer preserve the
+- * value so that we can restore it later. */
+- if ((old_offset=lseek(fd, 0, SEEK_CUR)) == (off_t) -1)
+- return -1;
+-
+- /* Set to wanted position. */
+- if (lseek (fd, offset, SEEK_SET) == (off_t) -1)
+- return -1;
+-
+- if (do_pwrite == 1) {
+- /* Write the data. */
+- result = write(fd, buf, count);
+- } else {
+- /* Read the data. */
+- result = read(fd, buf, count);
+- }
+-
+- /* Now we have to restore the position. If this fails we
+- * have to return this as an error. */
+- save_errno = errno;
+- if (lseek(fd, old_offset, SEEK_SET) == (off_t) -1)
+- {
+- if (result == -1)
+- __set_errno(save_errno);
+- return -1;
+- }
+- __set_errno(save_errno);
+- return(result);
+-}
+-
+-# ifdef __UCLIBC_HAS_LFS__
+-
+-static ssize_t __fake_pread_write64(int fd, void *buf,
+- size_t count, off64_t offset, int do_pwrite)
+-{
+- int save_errno;
+- ssize_t result;
+- off64_t old_offset;
+-
+- /* Since we must not change the file pointer preserve the
+- * value so that we can restore it later. */
+- if ((old_offset=lseek64(fd, 0, SEEK_CUR)) == (off64_t) -1)
+- return -1;
+-
+- /* Set to wanted position. */
+- if (lseek64(fd, offset, SEEK_SET) == (off64_t) -1)
+- return -1;
+-
+- if (do_pwrite == 1) {
+- /* Write the data. */
+- result = write(fd, buf, count);
+- } else {
+- /* Read the data. */
+- result = read(fd, buf, count);
+- }
+-
+- /* Now we have to restore the position. */
+- save_errno = errno;
+- if (lseek64 (fd, old_offset, SEEK_SET) == (off64_t) -1) {
+- if (result == -1)
+- __set_errno (save_errno);
+- return -1;
+- }
+- __set_errno (save_errno);
+- return result;
+-}
+-# endif /* __UCLIBC_HAS_LFS__ */
+-#endif /* ! defined __NR_pread || ! defined __NR_pwrite */
+-
+-#ifndef __NR_pread
+-ssize_t __libc_pread(int fd, void *buf, size_t count, off_t offset);
+-ssize_t __libc_pread(int fd, void *buf, size_t count, off_t offset)
+-{
+- return(__fake_pread_write(fd, buf, count, offset, 0));
+-}
+-weak_alias(__libc_pread,pread)
+-
+-# ifdef __UCLIBC_HAS_LFS__
+-ssize_t __libc_pread64(int fd, void *buf, size_t count, off64_t offset);
+-ssize_t __libc_pread64(int fd, void *buf, size_t count, off64_t offset)
+-{
+- return(__fake_pread_write64(fd, buf, count, offset, 0));
+-}
+-weak_alias(__libc_pread64,pread64)
+-# endif /* __UCLIBC_HAS_LFS__ */
+-#endif /* ! __NR_pread */
+-
+-
+-#ifndef __NR_pwrite
+-ssize_t __libc_pwrite(int fd, const void *buf, size_t count, off_t offset);
+-ssize_t __libc_pwrite(int fd, const void *buf, size_t count, off_t offset)
+-{
+- return(__fake_pread_write(fd, (void*)buf, count, offset, 1));
+-}
+-weak_alias(__libc_pwrite,pwrite)
+-
+-# ifdef __UCLIBC_HAS_LFS__
+-ssize_t __libc_pwrite64(int fd, const void *buf, size_t count, off64_t offset);
+-ssize_t __libc_pwrite64(int fd, const void *buf, size_t count, off64_t offset)
+-{
+- return(__fake_pread_write64(fd, (void*)buf, count, offset, 1));
+-}
+-weak_alias(__libc_pwrite64,pwrite64)
+-# endif /* __UCLIBC_HAS_LFS__ */
+-#endif /* ! __NR_pwrite */
+diff --git a/libc/sysdeps/linux/xtensa/pread_write.c b/libc/sysdeps/linux/xtensa/pread_write.c
+index bcf7dee..e8b39e9 100644
+--- a/libc/sysdeps/linux/xtensa/pread_write.c
++++ b/libc/sysdeps/linux/xtensa/pread_write.c
+@@ -89,115 +89,3 @@ ssize_t __libc_pwrite64(int fd, const void *buf, size_t count, off64_t offset)
+ weak_alias(__libc_pwrite64,pwrite64)
+ # endif /* __UCLIBC_HAS_LFS__ */
+ #endif /* __NR_pwrite */
+-
+-#if ! defined __NR_pread || ! defined __NR_pwrite
+-
+-static ssize_t __fake_pread_write(int fd, void *buf,
+- size_t count, off_t offset, int do_pwrite)
+-{
+- int save_errno;
+- ssize_t result;
+- off_t old_offset;
+-
+- /* Since we must not change the file pointer preserve the
+- * value so that we can restore it later. */
+- if ((old_offset=lseek(fd, 0, SEEK_CUR)) == (off_t) -1)
+- return -1;
+-
+- /* Set to wanted position. */
+- if (lseek(fd, offset, SEEK_SET) == (off_t) -1)
+- return -1;
+-
+- if (do_pwrite == 1) {
+- /* Write the data. */
+- result = write(fd, buf, count);
+- } else {
+- /* Read the data. */
+- result = read(fd, buf, count);
+- }
+-
+- /* Now we have to restore the position. If this fails we
+- * have to return this as an error. */
+- save_errno = errno;
+- if (lseek(fd, old_offset, SEEK_SET) == (off_t) -1)
+- {
+- if (result == -1)
+- __set_errno(save_errno);
+- return -1;
+- }
+- __set_errno(save_errno);
+- return(result);
+-}
+-
+-# ifdef __UCLIBC_HAS_LFS__
+-
+-static ssize_t __fake_pread_write64(int fd, void *buf,
+- size_t count, off64_t offset, int do_pwrite)
+-{
+- int save_errno;
+- ssize_t result;
+- off64_t old_offset;
+-
+- /* Since we must not change the file pointer preserve the
+- * value so that we can restore it later. */
+- if ((old_offset=lseek64(fd, 0, SEEK_CUR)) == (off64_t) -1)
+- return -1;
+-
+- /* Set to wanted position. */
+- if (lseek64(fd, offset, SEEK_SET) == (off64_t) -1)
+- return -1;
+-
+- if (do_pwrite == 1) {
+- /* Write the data. */
+- result = write(fd, buf, count);
+- } else {
+- /* Read the data. */
+- result = read(fd, buf, count);
+- }
+-
+- /* Now we have to restore the position. */
+- save_errno = errno;
+- if (lseek64(fd, old_offset, SEEK_SET) == (off64_t) -1) {
+- if (result == -1)
+- __set_errno (save_errno);
+- return -1;
+- }
+- __set_errno (save_errno);
+- return result;
+-}
+-# endif /* __UCLIBC_HAS_LFS__ */
+-#endif /* ! defined __NR_pread || ! defined __NR_pwrite */
+-
+-#ifndef __NR_pread
+-ssize_t __libc_pread(int fd, void *buf, size_t count, off_t offset)
+-{
+- return __fake_pread_write(fd, buf, count, offset, 0);
+-}
+-weak_alias(__libc_pread,pread)
+-
+-# ifdef __UCLIBC_HAS_LFS__
+-ssize_t __libc_pread64(int fd, void *buf, size_t count, off64_t offset)
+-{
+- return __fake_pread_write64(fd, buf, count, offset, 0);
+-}
+-weak_alias(__libc_pread64,pread64)
+-# endif /* __UCLIBC_HAS_LFS__ */
+-#endif /* ! __NR_pread */
+-
+-#ifndef __NR_pwrite
+-ssize_t __libc_pwrite(int fd, const void *buf, size_t count, off_t offset)
+-{
+- /* we won't actually be modifying the buffer,
+- *just cast it to get rid of warnings */
+- return __fake_pread_write(fd, (void*)buf, count, offset, 1);
+-}
+-weak_alias(__libc_pwrite,pwrite)
+-
+-# ifdef __UCLIBC_HAS_LFS__
+-ssize_t __libc_pwrite64(int fd, const void *buf, size_t count, off64_t offset)
+-{
+- return __fake_pread_write64(fd, (void*)buf, count, offset, 1);
+-}
+-weak_alias(__libc_pwrite64,pwrite64)
+-# endif /* __UCLIBC_HAS_LFS__ */
+-#endif /* ! __NR_pwrite */
+--
+1.7.11.1
+
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
+
diff --git a/main/libc0.9.32/0005-pread_write.c-make-all-archs-use-common-code.patch b/main/libc0.9.32/0005-pread_write.c-make-all-archs-use-common-code.patch
new file mode 100644
index 0000000000..5377a3f02a
--- /dev/null
+++ b/main/libc0.9.32/0005-pread_write.c-make-all-archs-use-common-code.patch
@@ -0,0 +1,671 @@
+From 5c7b0eadf777ba9539e723882138273d631ddc05 Mon Sep 17 00:00:00 2001
+From: "Peter S. Mazinger" <ps.m@gmx.net>
+Date: Fri, 22 Apr 2011 02:22:07 +0200
+Subject: [PATCH 5/6] pread_write.c: make all archs use common code
+
+c6x does not need own version at all
+
+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 836d74b92d70b71792d3d6136db7cdf0c3775ee3)
+---
+ libc/sysdeps/linux/c6x/Makefile.arch | 3 +-
+ libc/sysdeps/linux/c6x/pread_write.c | 103 ---------------------------
+ libc/sysdeps/linux/common/pread_write.c | 2 +
+ libc/sysdeps/linux/mips/pread_write.c | 116 +++++++++----------------------
+ libc/sysdeps/linux/powerpc/pread_write.c | 70 +++++--------------
+ libc/sysdeps/linux/sh/pread_write.c | 109 ++++-------------------------
+ libc/sysdeps/linux/xtensa/pread_write.c | 79 +++++----------------
+ 7 files changed, 88 insertions(+), 394 deletions(-)
+ delete mode 100644 libc/sysdeps/linux/c6x/pread_write.c
+
+diff --git a/libc/sysdeps/linux/c6x/Makefile.arch b/libc/sysdeps/linux/c6x/Makefile.arch
+index 6bb44f2..5f8aaec 100644
+--- a/libc/sysdeps/linux/c6x/Makefile.arch
++++ b/libc/sysdeps/linux/c6x/Makefile.arch
+@@ -5,6 +5,7 @@
+ # Licensed under the LGPL v2.1, see the file COPYING.LIB in this tarball.
+ #
+
+-CSRC := brk.c pread_write.c syscall.c prctl.c
++CSRC := brk.c syscall.c prctl.c
++#CSRC :=
+
+ SSRC := __longjmp.S bsd-_setjmp.S bsd-setjmp.S clone.S setjmp.S _vfork.S
+diff --git a/libc/sysdeps/linux/c6x/pread_write.c b/libc/sysdeps/linux/c6x/pread_write.c
+deleted file mode 100644
+index f985b43..0000000
+--- a/libc/sysdeps/linux/c6x/pread_write.c
++++ /dev/null
+@@ -1,103 +0,0 @@
+-/* vi: set sw=4 ts=4:
+- *
+- * Copyright (C) 2002 by Erik Andersen <andersen@uclibc.org>
+- * Based in part on the files
+- * ./sysdeps/unix/sysv/linux/pwrite.c,
+- * ./sysdeps/unix/sysv/linux/pread.c,
+- * sysdeps/posix/pread.c
+- * sysdeps/posix/pwrite.c
+- * from GNU libc 2.2.5, but reworked considerably...
+- *
+- * This program is free software; you can redistribute it and/or modify it
+- * under the terms of the GNU Library General Public License as published by
+- * the Free Software Foundation; either version 2 of the License, or (at your
+- * option) any later version.
+- *
+- * This program is distributed in the hope that it will be useful, but WITHOUT
+- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+- * FITNESS FOR A PARTICULAR PURPOSE. See the GNU Library General Public License
+- * for more details.
+- *
+- * You should have received a copy of the GNU Library General Public License
+- * along with this program; if not, write to the Free Software Foundation,
+- * Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+- */
+-
+-#define _LARGEFILE64_SOURCE
+-#include <features.h>
+-#undef __OPTIMIZE__
+-/* We absolutely do _NOT_ want interfaces silently
+- * * * renamed under us or very bad things will happen... */
+-#ifdef __USE_FILE_OFFSET64
+-# undef __USE_FILE_OFFSET64
+-#endif
+-
+-
+-#include <errno.h>
+-#include <sys/types.h>
+-#include <sys/syscall.h>
+-#include <unistd.h>
+-#include <stdint.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_pread
+-# error "__NR_pread and __NR_pread64 both defined???"
+-# endif
+-# define __NR_pread __NR_pread64
+-#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);
+-
+-ssize_t __libc_pread(int fd, void *buf, size_t count, off_t offset)
+-{
+- return(__syscall_pread(fd,buf,count,offset,offset >> 31));
+-}
+-weak_alias (__libc_pread, pread)
+-
+-#if defined __UCLIBC_HAS_LFS__
+-ssize_t __libc_pread64(int fd, void *buf, size_t count, off64_t offset)
+-{
+- uint32_t low = offset & 0xffffffff;
+- uint32_t high = offset >> 32;
+- return(__syscall_pread(fd, buf, count, low, high));
+-}
+-weak_alias (__libc_pread64, pread64)
+-#endif /* __UCLIBC_HAS_LFS__ */
+-
+-
+-#ifdef __NR_pwrite64 /* Newer kernels renamed but it's the same. */
+-# ifdef __NR_pwrite
+-# error "__NR_pwrite and __NR_pwrite64 both defined???"
+-# endif
+-# define __NR_pwrite __NR_pwrite64
+-#endif
+-
+-#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)
+-{
+- return(__syscall_pwrite(fd,buf,count,offset,offset >> 31));
+-}
+-weak_alias (__libc_pwrite, pwrite)
+-
+-#if defined __UCLIBC_HAS_LFS__
+-ssize_t __libc_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, low, high));
+-}
+-weak_alias (__libc_pwrite64, pwrite64)
+-#endif /* __UCLIBC_HAS_LFS__ */
+-
+diff --git a/libc/sysdeps/linux/common/pread_write.c b/libc/sysdeps/linux/common/pread_write.c
+index 3d04bb7..dd5d36c 100644
+--- a/libc/sysdeps/linux/common/pread_write.c
++++ b/libc/sysdeps/linux/common/pread_write.c
+@@ -35,6 +35,7 @@ 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
+ #endif
+
+ #ifndef MY_PWRITE
+@@ -44,6 +45,7 @@ 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
+ #endif
+
+ static ssize_t __NC(pread)(int fd, void *buf, size_t count, off_t offset)
+diff --git a/libc/sysdeps/linux/mips/pread_write.c b/libc/sysdeps/linux/mips/pread_write.c
+index ea6b15f..b777dc4 100644
+--- a/libc/sysdeps/linux/mips/pread_write.c
++++ b/libc/sysdeps/linux/mips/pread_write.c
+@@ -4,76 +4,39 @@
+ *
+ * Licensed under the LGPL v2.1, see the file COPYING.LIB in this tarball.
+ */
+-/*
+- * Based in part on the files
+- * ./sysdeps/unix/sysv/linux/pwrite.c,
+- * ./sysdeps/unix/sysv/linux/pread.c,
+- * sysdeps/posix/pread.c
+- * sysdeps/posix/pwrite.c
+- * from GNU libc 2.2.5, but reworked considerably...
+- */
+
+ #include <sys/syscall.h>
+ #include <unistd.h>
+-#include <stdint.h>
+ #include <endian.h>
+ #include <sgidefs.h>
+
+-#ifdef __NR_pread64 /* Newer kernels renamed but it's the same. */
++#ifdef __NR_pread64
+ # ifdef __NR_pread
+ # error "__NR_pread and __NR_pread64 both defined???"
+ # endif
+ # define __NR_pread __NR_pread64
+ #endif
+
+-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
+-
+-#include <bits/kernel_types.h>
+-
+-
+ #ifdef __NR_pread
+-
+-# if _MIPS_SIM == _MIPS_SIM_ABI64
+-# define __NR___libc_pread __NR_pread
+-_syscall4(ssize_t, __libc_pread, int, fd, void *, buf, size_t, count, off_t, offset)
+-weak_alias (__libc_pread, pread)
+-# ifdef __UCLIBC_HAS_LFS__
+-# define __NR___libc_pread64 __NR_pread
+-_syscall4(ssize_t, __libc_pread64, int, fd, void *, buf, size_t, count, off64_t, offset)
+-weak_alias (__libc_pread64, pread64)
+-# endif /* __UCLIBC_HAS_LFS__ */
++# if _MIPS_SIM == _MIPS_SIM_ABI64 /* glibc uses it for N32 as well */
++# define __NR___syscall_pread __NR_pread
++static _syscall4(ssize_t, __syscall_pread, int, fd, void *, buf, size_t, count, off_t, offset)
++# define MY_PREAD(fd, buf, count, offset) \
++ __syscall_pread(fd, buf, count, offset)
++# define MY_PREAD64(fd, buf, count, offset) \
++ __syscall_pread(fd, buf, count, offset)
+ # else /* O32 || N32 */
+ # define __NR___syscall_pread __NR_pread
+-static __inline__ _syscall6(ssize_t, __syscall_pread, int, fd, void *, buf,
+- size_t, count, int, dummy, off_t, offset_hi, off_t, offset_lo)
+-
+-ssize_t __libc_pread(int fd, void *buf, size_t count, off_t offset)
+-{
+- return(__syscall_pread(fd,buf,count,0,__LONG_LONG_PAIR(offset>>31,offset)));
+-}
+-weak_alias(__libc_pread,pread)
+-
+-# ifdef __UCLIBC_HAS_LFS__
+-ssize_t __libc_pread64(int fd, void *buf, size_t count, off64_t offset)
+-{
+- uint32_t low = offset & 0xffffffff;
+- uint32_t high = offset >> 32;
+- return(__syscall_pread(fd, buf, count, 0, __LONG_LONG_PAIR (high, low)));
+-}
+-weak_alias(__libc_pread64,pread64)
+-# endif /* __UCLIBC_HAS_LFS__ */
+-# endif /* O32 || N32 */
+-
+-#endif /* __NR_pread */
+-
+-/**********************************************************************/
++static _syscall6(ssize_t, __syscall_pread, int, fd, void *, buf,
++ size_t, count, int, dummy, off_t, offset_hi, off_t, offset_lo)
++# define MY_PREAD(fd, buf, count, offset) \
++ __syscall_pread(fd, buf, count, 0, OFF_HI_LO(offset))
++# define MY_PREAD64(fd, buf, count, offset) \
++ __syscall_pread(fd, buf, count, 0, OFF64_HI_LO(offset))
++# endif
++#endif
+
+-#ifdef __NR_pwrite64 /* Newer kernels renamed but it's the same. */
++#ifdef __NR_pwrite64
+ # ifdef __NR_pwrite
+ # error "__NR_pwrite and __NR_pwrite64 both defined???"
+ # endif
+@@ -81,35 +44,22 @@ weak_alias(__libc_pread64,pread64)
+ #endif
+
+ #ifdef __NR_pwrite
+-
+-# if _MIPS_SIM == _MIPS_SIM_ABI64
+-# define __NR___libc_pwrite __NR_pwrite
+-_syscall4(ssize_t, __libc_pwrite, int, fd, const void *, buf, size_t, count, off_t, offset)
+-weak_alias (__libc_pwrite, pwrite)
+-# ifdef __UCLIBC_HAS_LFS__
+-# define __NR___libc_pwrite64 __NR_pwrite
+-_syscall4(ssize_t, __libc_pwrite64, int, fd, const void *, buf, size_t, count, off64_t, offset)
+-weak_alias (__libc_pwrite64, pwrite64)
+-# endif /* __UCLIBC_HAS_LFS__ */
++# if _MIPS_SIM == _MIPS_SIM_ABI64 /* glibc uses it for N32 as well */
++# define __NR___syscall_pwrite __NR_pwrite
++static _syscall4(ssize_t, __syscall_pwrite, int, fd, const void *, buf, size_t, count, off_t, offset)
++# define MY_PWRITE(fd, buf, count, offset) \
++ __syscall_pwrite(fd, buf, count, offset)
++# define MY_PWRITE64(fd, buf, count, offset) \
++ __syscall_pwrite(fd, buf, count, offset)
+ # else /* O32 || N32 */
+ # define __NR___syscall_pwrite __NR_pwrite
+-static __inline__ _syscall6(ssize_t, __syscall_pwrite, int, fd, const void *, buf,
+- size_t, count, int, dummy, off_t, offset_hi, off_t, offset_lo)
+-
+-ssize_t __libc_pwrite(int fd, const void *buf, size_t count, off_t offset)
+-{
+- return(__syscall_pwrite(fd,buf,count,0,__LONG_LONG_PAIR(offset>>31,offset)));
+-}
+-weak_alias(__libc_pwrite,pwrite)
++static _syscall6(ssize_t, __syscall_pwrite, int, fd, const void *, buf,
++ size_t, count, int, dummy, off_t, offset_hi, off_t, offset_lo)
++# define MY_PWRITE(fd, buf, count, offset) \
++ __syscall_pwrite(fd, buf, count, 0, OFF_HI_LO(offset))
++# define MY_PWRITE64(fd, buf, count, offset) \
++ __syscall_pwrite(fd, buf, count, 0, OFF64_HI_LO(offset))
++# endif
++#endif
+
+-# ifdef __UCLIBC_HAS_LFS__
+-ssize_t __libc_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, 0, __LONG_LONG_PAIR (high, low)));
+-}
+-weak_alias(__libc_pwrite64,pwrite64)
+-# endif /* __UCLIBC_HAS_LFS__ */
+-# endif /* O32 || N32 */
+-#endif /* __NR_pwrite */
++#include "../common/pread_write.c"
+diff --git a/libc/sysdeps/linux/powerpc/pread_write.c b/libc/sysdeps/linux/powerpc/pread_write.c
+index 92a184c..5cb3386 100644
+--- a/libc/sysdeps/linux/powerpc/pread_write.c
++++ b/libc/sysdeps/linux/powerpc/pread_write.c
+@@ -1,26 +1,15 @@
+-/* vi: set sw=4 ts=4:
+- *
++/* vi: set sw=4 ts=4: */
++/*
+ * Copyright (C) 2000-2006 Erik Andersen <andersen@uclibc.org>
+ *
+ * Licensed under the LGPL v2.1, see the file COPYING.LIB in this tarball.
+ */
+-/* Based in part on the files
+- * ./sysdeps/unix/sysv/linux/pwrite.c,
+- * ./sysdeps/unix/sysv/linux/pread.c,
+- * sysdeps/posix/pread.c
+- * sysdeps/posix/pwrite.c
+- * from GNU libc 2.2.5, but reworked considerably...
+- */
+
+ #include <sys/syscall.h>
+ #include <unistd.h>
+ #include <endian.h>
+
+-#ifndef __UCLIBC_HAS_LFS__
+-# define off64_t off_t
+-#endif
+-
+-#ifdef __NR_pread64 /* Newer kernels renamed but it's the same. */
++#ifdef __NR_pread64
+ # ifdef __NR_pread
+ # error "__NR_pread and __NR_pread64 both defined???"
+ # endif
+@@ -28,28 +17,16 @@
+ #endif
+
+ #ifdef __NR_pread
+-extern __typeof(pread) __libc_pread;
+ # define __NR___syscall_pread __NR_pread
+-static __inline__ _syscall6(ssize_t, __syscall_pread, int, fd,
+- void *, buf, size_t, count, int, dummy, off_t, offset_hi, off_t, offset_lo)
+-
+-ssize_t __libc_pread(int fd, void *buf, size_t count, off_t offset)
+-{
+- return(__syscall_pread(fd, buf, count, 0, __LONG_LONG_PAIR(offset >> 31, offset)));
+-}
+-weak_alias(__libc_pread,pread)
+-
+-# ifdef __UCLIBC_HAS_LFS__
+-extern __typeof(pread64) __libc_pread64;
+-ssize_t __libc_pread64(int fd, void *buf, size_t count, off64_t offset)
+-{
+- return(__syscall_pread(fd, buf, count, 0, __LONG_LONG_PAIR(offset >> 32, offset)));
+-}
+-weak_alias(__libc_pread64,pread64)
+-# endif /* __UCLIBC_HAS_LFS__ */
+-#endif /* __NR_pread */
++static _syscall6(ssize_t, __syscall_pread, int, fd, void *, buf,
++ size_t, count, int, dummy, off_t, offset_hi, off_t, offset_lo)
++# define MY_PREAD(fd, buf, count, offset) \
++ __syscall_pread(fd, buf, count, 0, OFF_HI_LO(offset))
++# define MY_PREAD64(fd, buf, count, offset) \
++ __syscall_pread(fd, buf, count, 0, OFF64_HI_LO(offset))
++#endif
+
+-#ifdef __NR_pwrite64 /* Newer kernels renamed but it's the same. */
++#ifdef __NR_pwrite64
+ # ifdef __NR_pwrite
+ # error "__NR_pwrite and __NR_pwrite64 both defined???"
+ # endif
+@@ -57,23 +34,14 @@ weak_alias(__libc_pread64,pread64)
+ #endif
+
+ #ifdef __NR_pwrite
+-extern __typeof(pwrite) __libc_pwrite;
+ # define __NR___syscall_pwrite __NR_pwrite
+-static __inline__ _syscall6(ssize_t, __syscall_pwrite, int, fd,
+- const void *, buf, size_t, count, int, dummy, off_t, offset_hi, off_t, offset_lo)
+
+-ssize_t __libc_pwrite(int fd, const void *buf, size_t count, off_t offset)
+-{
+- return(__syscall_pwrite(fd, buf, count, 0, __LONG_LONG_PAIR(offset >> 31, offset)));
+-}
+-weak_alias(__libc_pwrite,pwrite)
++static _syscall6(ssize_t, __syscall_pwrite, int, fd, const void *, buf,
++ size_t, count, int, dummy, off_t, offset_hi, off_t, offset_lo)
++# define MY_PWRITE(fd, buf, count, offset) \
++ __syscall_pwrite(fd, buf, count, 0, OFF_HI_LO(offset))
++# define MY_PWRITE64(fd, buf, count, offset) \
++ __syscall_pwrite(fd, buf, count, 0, OFF64_HI_LO(offset))
++#endif
+
+-# ifdef __UCLIBC_HAS_LFS__
+-extern __typeof(pwrite64) __libc_pwrite64;
+-ssize_t __libc_pwrite64(int fd, const void *buf, size_t count, off64_t offset)
+-{
+- return(__syscall_pwrite(fd, buf, count, 0, __LONG_LONG_PAIR(offset >> 32, offset)));
+-}
+-weak_alias(__libc_pwrite64,pwrite64)
+-# endif /* __UCLIBC_HAS_LFS__ */
+-#endif /* __NR_pwrite */
++#include "../common/pread_write.c"
+diff --git a/libc/sysdeps/linux/sh/pread_write.c b/libc/sysdeps/linux/sh/pread_write.c
+index 86feb9c..f4453a6 100644
+--- a/libc/sysdeps/linux/sh/pread_write.c
++++ b/libc/sysdeps/linux/sh/pread_write.c
+@@ -4,28 +4,12 @@
+ *
+ * Licensed under the LGPL v2.1, see the file COPYING.LIB in this tarball.
+ */
+-/*
+- * Based in part on the files
+- * ./sysdeps/unix/sysv/linux/pwrite.c,
+- * ./sysdeps/unix/sysv/linux/pread.c,
+- * sysdeps/posix/pread.c
+- * sysdeps/posix/pwrite.c
+- * from GNU libc 2.2.5, but reworked considerably...
+- */
+
+ #include <sys/syscall.h>
+ #include <unistd.h>
+-#include <stdint.h>
+ #include <endian.h>
+
+-#ifdef __UCLIBC_HAS_THREADS_NATIVE__
+-#include <sysdep-cancel.h>
+-#else
+-#define SINGLE_THREAD_P 1
+-#endif
+-
+-
+-#ifdef __NR_pread64 /* Newer kernels renamed but it's the same. */
++#ifdef __NR_pread64
+ # ifdef __NR_pread
+ # error "__NR_pread and __NR_pread64 both defined???"
+ # endif
+@@ -33,49 +17,16 @@
+ #endif
+
+ #ifdef __NR_pread
+-extern __typeof(pread) __libc_pread;
+ # define __NR___syscall_pread __NR_pread
+-static __inline__ _syscall6(ssize_t, __syscall_pread, int, fd, void *, buf,
+- size_t, count, int, dummy, off_t, offset_hi, off_t, offset_lo)
+-
+-ssize_t __libc_pread(int fd, void *buf, size_t count, off_t offset)
+-{
+- if (SINGLE_THREAD_P)
+- return(__syscall_pread(fd,buf,count,0,__LONG_LONG_PAIR(offset >> 31,offset)));
+-
+-#ifdef __UCLIBC_HAS_THREADS_NATIVE__
+- int oldtype = LIBC_CANCEL_ASYNC ();
+- ssize_t result = __syscall_pread(fd,buf,count,0,__LONG_LONG_PAIR(offset >> 31,offset));
+- LIBC_CANCEL_RESET (oldtype);
+- return result;
+-#endif
+-}
+-weak_alias(__libc_pread,pread)
+-
+-# ifdef __UCLIBC_HAS_LFS__
+-extern __typeof(pread64) __libc_pread64;
+-ssize_t __libc_pread64(int fd, void *buf, size_t count, off64_t offset)
+-{
+- uint32_t low = offset & 0xffffffff;
+- uint32_t high = offset >> 32;
+-
+- if (SINGLE_THREAD_P)
+- return __syscall_pread(fd, buf, count, 0, __LONG_LONG_PAIR (high, low));
+-
+-#ifdef __UCLIBC_HAS_THREADS_NATIVE__
+- int oldtype = LIBC_CANCEL_ASYNC ();
+- ssize_t result = __syscall_pread(fd, buf, count, 0, __LONG_LONG_PAIR (high, low));
+- LIBC_CANCEL_RESET (oldtype);
+- return result;
++static _syscall6(ssize_t, __syscall_pread, int, fd, void *, buf,
++ size_t, count, int, dummy, off_t, offset_hi, off_t, offset_lo)
++# define MY_PREAD(fd, buf, count, offset) \
++ __syscall_pread(fd, buf, count, 0, OFF_HI_LO(offset))
++# define MY_PREAD64(fd, buf, count, offset) \
++ __syscall_pread(fd, buf, count, 0, OFF64_HI_LO(offset))
+ #endif
+-}
+-weak_alias(__libc_pread64,pread64)
+-# endif /* __UCLIBC_HAS_LFS__ */
+-#endif /* __NR_pread */
+-
+-/**********************************************************************/
+
+-#ifdef __NR_pwrite64 /* Newer kernels renamed but it's the same. */
++#ifdef __NR_pwrite64
+ # ifdef __NR_pwrite
+ # error "__NR_pwrite and __NR_pwrite64 both defined???"
+ # endif
+@@ -83,43 +34,13 @@ weak_alias(__libc_pread64,pread64)
+ #endif
+
+ #ifdef __NR_pwrite
+-extern __typeof(pwrite) __libc_pwrite;
+ # define __NR___syscall_pwrite __NR_pwrite
+-static __inline__ _syscall6(ssize_t, __syscall_pwrite, int, fd, const void *, buf,
+- size_t, count, int, dummy, off_t, offset_hi, off_t, offset_lo)
+-
+-ssize_t __libc_pwrite(int fd, const void *buf, size_t count, off_t offset)
+-{
+- if (SINGLE_THREAD_P)
+- return __syscall_pwrite(fd,buf,count,0,__LONG_LONG_PAIR(offset >> 31,offset));
+-
+-#ifdef __UCLIBC_HAS_THREADS_NATIVE__
+- int oldtype = LIBC_CANCEL_ASYNC ();
+- ssize_t result = __syscall_pwrite(fd,buf,count,0,__LONG_LONG_PAIR(offset >> 31,offset));
+- LIBC_CANCEL_RESET (oldtype);
+- return result;
++static _syscall6(ssize_t, __syscall_pwrite, int, fd, const void *, buf,
++ size_t, count, int, dummy, off_t, offset_hi, off_t, offset_lo)
++# define MY_PWRITE(fd, buf, count, offset) \
++ __syscall_pwrite(fd, buf, count, 0, OFF_HI_LO(offset))
++# define MY_PWRITE64(fd, buf, count, offset) \
++ __syscall_pwrite(fd, buf, count, 0, OFF64_HI_LO(offset))
+ #endif
+
+-}
+-weak_alias(__libc_pwrite,pwrite)
+-
+-# ifdef __UCLIBC_HAS_LFS__
+-extern __typeof(pwrite64) __libc_pwrite64;
+-ssize_t __libc_pwrite64(int fd, const void *buf, size_t count, off64_t offset)
+-{
+- uint32_t low = offset & 0xffffffff;
+- uint32_t high = offset >> 32;
+-
+- if (SINGLE_THREAD_P)
+- return __syscall_pwrite(fd, buf, count, 0, __LONG_LONG_PAIR (high, low));
+-
+-#ifdef __UCLIBC_HAS_THREADS_NATIVE__
+- int oldtype = LIBC_CANCEL_ASYNC ();
+- ssize_t result = __syscall_pwrite(fd, buf, count, 0, __LONG_LONG_PAIR (high, low));
+- LIBC_CANCEL_RESET (oldtype);
+- return result;
+-#endif
+-}
+-weak_alias(__libc_pwrite64,pwrite64)
+-# endif /* __UCLIBC_HAS_LFS__ */
+-#endif /* __NR_pwrite */
++#include "../common/pread_write.c"
+diff --git a/libc/sysdeps/linux/xtensa/pread_write.c b/libc/sysdeps/linux/xtensa/pread_write.c
+index e8b39e9..f4453a6 100644
+--- a/libc/sysdeps/linux/xtensa/pread_write.c
++++ b/libc/sysdeps/linux/xtensa/pread_write.c
+@@ -4,30 +4,12 @@
+ *
+ * Licensed under the LGPL v2.1, see the file COPYING.LIB in this tarball.
+ */
+-/*
+- * Based in part on the files
+- * ./sysdeps/unix/sysv/linux/pwrite.c,
+- * ./sysdeps/unix/sysv/linux/pread.c,
+- * sysdeps/posix/pread.c
+- * sysdeps/posix/pwrite.c
+- * from GNU libc 2.2.5, but reworked considerably...
+- */
+
+ #include <sys/syscall.h>
+ #include <unistd.h>
+-#include <stdint.h>
+ #include <endian.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
+-
+-#include <bits/kernel_types.h>
+-
+-#ifdef __NR_pread64 /* Newer kernels renamed but it's the same. */
++#ifdef __NR_pread64
+ # ifdef __NR_pread
+ # error "__NR_pread and __NR_pread64 both defined???"
+ # endif
+@@ -35,31 +17,16 @@ extern __typeof(pwrite64) __libc_pwrite64;
+ #endif
+
+ #ifdef __NR_pread
+-
+ # define __NR___syscall_pread __NR_pread
+-/* On Xtensa, 64-bit values are aligned in even/odd register pairs. */
+-static __inline__ _syscall6(ssize_t, __syscall_pread, int, fd, void *, buf,
+- size_t, count, int, pad, off_t, offset_hi, off_t, offset_lo)
+-
+-ssize_t __libc_pread(int fd, void *buf, size_t count, off_t offset)
+-{
+- return __syscall_pread(fd, buf, count, 0, __LONG_LONG_PAIR(offset >> 31, offset));
+-}
+-weak_alias(__libc_pread,pread)
+-
+-# ifdef __UCLIBC_HAS_LFS__
+-ssize_t __libc_pread64(int fd, void *buf, size_t count, off64_t offset)
+-{
+- uint32_t low = offset & 0xffffffff;
+- uint32_t high = offset >> 32;
+- return __syscall_pread(fd, buf, count, 0, __LONG_LONG_PAIR(high, low));
+-}
+-weak_alias(__libc_pread64,pread64)
+-# endif /* __UCLIBC_HAS_LFS__ */
+-
+-#endif /* __NR_pread */
++static _syscall6(ssize_t, __syscall_pread, int, fd, void *, buf,
++ size_t, count, int, dummy, off_t, offset_hi, off_t, offset_lo)
++# define MY_PREAD(fd, buf, count, offset) \
++ __syscall_pread(fd, buf, count, 0, OFF_HI_LO(offset))
++# define MY_PREAD64(fd, buf, count, offset) \
++ __syscall_pread(fd, buf, count, 0, OFF64_HI_LO(offset))
++#endif
+
+-#ifdef __NR_pwrite64 /* Newer kernels renamed but it's the same. */
++#ifdef __NR_pwrite64
+ # ifdef __NR_pwrite
+ # error "__NR_pwrite and __NR_pwrite64 both defined???"
+ # endif
+@@ -67,25 +34,13 @@ weak_alias(__libc_pread64,pread64)
+ #endif
+
+ #ifdef __NR_pwrite
+-
+ # define __NR___syscall_pwrite __NR_pwrite
+-/* On Xtensa, 64-bit values are aligned in even/odd register pairs. */
+-static __inline__ _syscall6(ssize_t, __syscall_pwrite, int, fd, const void *, buf,
+- size_t, count, int, pad, off_t, offset_hi, off_t, offset_lo)
+-
+-ssize_t __libc_pwrite(int fd, const void *buf, size_t count, off_t offset)
+-{
+- return __syscall_pwrite(fd, buf, count, 0, __LONG_LONG_PAIR(offset >> 31, offset));
+-}
+-weak_alias(__libc_pwrite,pwrite)
++static _syscall6(ssize_t, __syscall_pwrite, int, fd, const void *, buf,
++ size_t, count, int, dummy, off_t, offset_hi, off_t, offset_lo)
++# define MY_PWRITE(fd, buf, count, offset) \
++ __syscall_pwrite(fd, buf, count, 0, OFF_HI_LO(offset))
++# define MY_PWRITE64(fd, buf, count, offset) \
++ __syscall_pwrite(fd, buf, count, 0, OFF64_HI_LO(offset))
++#endif
+
+-# ifdef __UCLIBC_HAS_LFS__
+-ssize_t __libc_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, 0, __LONG_LONG_PAIR(high, low));
+-}
+-weak_alias(__libc_pwrite64,pwrite64)
+-# endif /* __UCLIBC_HAS_LFS__ */
+-#endif /* __NR_pwrite */
++#include "../common/pread_write.c"
+--
+1.7.11.1
+
diff --git a/main/libc0.9.32/0006-endian.h-add-some-handy-macros-to-be-used-in-syscall.patch b/main/libc0.9.32/0006-endian.h-add-some-handy-macros-to-be-used-in-syscall.patch
new file mode 100644
index 0000000000..252c4b7c5a
--- /dev/null
+++ b/main/libc0.9.32/0006-endian.h-add-some-handy-macros-to-be-used-in-syscall.patch
@@ -0,0 +1,37 @@
+From 3dfbb6b7778d05aa7e3809e139115edfd2e0a342 Mon Sep 17 00:00:00 2001
+From: "Peter S. Mazinger" <ps.m@gmx.net>
+Date: Thu, 21 Apr 2011 21:20:55 +0200
+Subject: [PATCH 6/6] endian.h: add some handy macros to be used in syscalls
+
+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 f6a03f19cf2807170717593b4de8056a1248b99b)
+---
+ include/endian.h | 11 +++++++++++
+ 1 file changed, 11 insertions(+)
+
+diff --git a/include/endian.h b/include/endian.h
+index 0ba7384..1e2fc93 100644
+--- a/include/endian.h
++++ b/include/endian.h
+@@ -55,6 +55,17 @@
+ # define __LONG_LONG_PAIR(HI, LO) HI, LO
+ #endif
+
++#ifdef _LIBC
++# ifndef __ASSEMBLER__
++# include <stdint.h>
++# define OFF_HI(offset) (offset >> 31)
++# define OFF_LO(offset) (offset)
++# define OFF64_HI(offset) (uint32_t)(offset >> 32)
++# define OFF64_LO(offset) (uint32_t)(offset & 0xffffffff)
++# define OFF_HI_LO(offset) __LONG_LONG_PAIR(OFF_HI(offset), OFF_LO(offset))
++# define OFF64_HI_LO(offset) __LONG_LONG_PAIR(OFF64_HI(offset), OFF64_LO(offset))
++# endif
++#endif
+
+ #ifdef __USE_BSD
+ /* Conversion interfaces. */
+--
+1.7.11.1
+
diff --git a/main/libc0.9.32/APKBUILD b/main/libc0.9.32/APKBUILD
index a35750cc55..326c5075c5 100644
--- a/main/libc0.9.32/APKBUILD
+++ b/main/libc0.9.32/APKBUILD
@@ -4,7 +4,7 @@ pkgname=libc$_abiver
_gitver=
pkgver=0.9.33.2
_ver=${pkgver/_/-}
-pkgrel=5
+pkgrel=6
pkgdesc="C library for developing embedded Linux systems"
url=http://uclibc.org
license="LGPL-2"
@@ -35,9 +35,15 @@ source="http://uclibc.org/downloads/uClibc-${_ver}.tar.xz
eventfd.patch
uClibc-0.9.33-avahi.patch
0001-libc-add-posix_fallocate.patch
- pread.patch
posix_fallocate-fix.patch
+ 0001-cancel.h-add-generic-file-to-ease-cancellation-suppo.patch
+ 0002-pread-pwrite-handle-renamed-syscalls-in-common-ppc-x.patch
+ 0003-pread-pwrite-drop-fallback-funcs.patch
+ 0004-add-cancellation-to-generic-pread_write.patch
+ 0005-pread_write.c-make-all-archs-use-common-code.patch
+ 0006-endian.h-add-some-handy-macros-to-be-used-in-syscall.patch
+
uclibcconfig.x86
uclibcconfig.x86_64
uclibcconfig.i486
@@ -45,9 +51,6 @@ uClibc-0.9.33-avahi.patch
uclibcconfig.powerpc
uclibc-utils.trigger
"
-#pread-rename.patch
-#pread-remove-fallback.patch
-#pread-cancellable.patch
_config="$srcdir"/uclibcconfig.${CARCH}
_builddir="$srcdir"/uClibc-${_ver}
@@ -145,8 +148,13 @@ d9611de57fb72b74c0b9e243b8e9165b 0007-libc-x86-fix-stack-unwinding-and-backtrac
a86eb40e8aca531a1cfee5faff3c53d4 eventfd.patch
d91fcb785ae14632a4ea8fa03ba0236f uClibc-0.9.33-avahi.patch
08297e76052108d95303efe7d8745444 0001-libc-add-posix_fallocate.patch
-1cc5c5f3f1d2a66c0ab0f8585627faa9 pread.patch
a93a0e50e73bb6e8d8abf6e4340378b6 posix_fallocate-fix.patch
+085d98078455ad0f0c2d63c6fa9ea67c 0001-cancel.h-add-generic-file-to-ease-cancellation-suppo.patch
+583a8b6d4a29abe0b6ac449a1694b079 0002-pread-pwrite-handle-renamed-syscalls-in-common-ppc-x.patch
+f059f5e437ed4fe1b6973dd08972e583 0003-pread-pwrite-drop-fallback-funcs.patch
+1983ddd723a96432aba74b1132bd6e29 0004-add-cancellation-to-generic-pread_write.patch
+32544dc16cc1b4845484535bf758a4b1 0005-pread_write.c-make-all-archs-use-common-code.patch
+73037bc978897e20ae2fc531759443eb 0006-endian.h-add-some-handy-macros-to-be-used-in-syscall.patch
ce8a33a31f5a53031fbad8b1d1b66d44 uclibcconfig.x86
e861a17baa541accf4d4d39a98d74c32 uclibcconfig.x86_64
ce8a33a31f5a53031fbad8b1d1b66d44 uclibcconfig.i486
diff --git a/main/libc0.9.32/pread.patch b/main/libc0.9.32/pread.patch
deleted file mode 100644
index 443d3b561e..0000000000
--- a/main/libc0.9.32/pread.patch
+++ /dev/null
@@ -1,207 +0,0 @@
-pread/pwrite syscalls has been renamed to pread64/pwrite in 2.6 kernel.
-
-There was a fallback function using lseek for kernels who did not have
-this syscall (pre 2.1.60). This is broken in many ways.
-
-uclibc have been using the broken fallback due to they forgot to rename
-pread syscall.
-
-This got detected with git-1.7.11 which introduced threaded index-pack
-which broke in similar ways a windows (msys).
-
-This issue in uclibc have been reported upstream and fixed in git master
-so this patch does not need to be upstreamed. It might be an idea to
-backport it properly for 0.9.33 branch though.
-
-
-diff --git a/libc/sysdeps/linux/common/pread_write.c b/libc/sysdeps/linux/common/pread_write.c
-index 88e6957..9fa7cab 100644
---- a/libc/sysdeps/linux/common/pread_write.c
-+++ b/libc/sysdeps/linux/common/pread_write.c
-@@ -17,6 +17,7 @@
- #include <unistd.h>
- #include <stdint.h>
- #include <endian.h>
-+#include <sysdep-cancel.h>
-
- extern __typeof(pread) __libc_pread;
- extern __typeof(pwrite) __libc_pwrite;
-@@ -27,15 +28,17 @@ extern __typeof(pwrite64) __libc_pwrite64;
-
- #include <bits/kernel_types.h>
-
--#ifdef __NR_pread
--
--# define __NR___syscall_pread __NR_pread
-+# define __NR___syscall_pread __NR_pread64
- static __inline__ _syscall5(ssize_t, __syscall_pread, int, fd, void *, buf,
- size_t, count, off_t, offset_hi, off_t, offset_lo)
-
- ssize_t __libc_pread(int fd, void *buf, size_t count, off_t offset)
- {
-- return __syscall_pread(fd, buf, count, __LONG_LONG_PAIR(offset >> 31, offset));
-+ int oldtype = LIBC_CANCEL_ASYNC ();
-+ int result = __syscall_pread(fd, buf, count, __LONG_LONG_PAIR(offset >> 31, offset));
-+ LIBC_CANCEL_RESET (oldtype);
-+ return result;
-+
- }
- weak_alias(__libc_pread,pread)
-
-@@ -44,22 +47,24 @@ ssize_t __libc_pread64(int fd, void *buf, size_t count, off64_t offset)
- {
- uint32_t low = offset & 0xffffffff;
- uint32_t high = offset >> 32;
-- return __syscall_pread(fd, buf, count, __LONG_LONG_PAIR(high, low));
-+ int oldtype = LIBC_CANCEL_ASYNC ();
-+ int result = __syscall_pread(fd, buf, count, __LONG_LONG_PAIR(high, low));
-+ LIBC_CANCEL_RESET (oldtype);
-+ return result;
- }
- weak_alias(__libc_pread64,pread64)
- # endif /* __UCLIBC_HAS_LFS__ */
-
--#endif /* __NR_pread */
--
--#ifdef __NR_pwrite
--
--# define __NR___syscall_pwrite __NR_pwrite
-+# define __NR___syscall_pwrite __NR_pwrite64
- 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)
- {
-- return __syscall_pwrite(fd, buf, count, __LONG_LONG_PAIR(offset >> 31, offset));
-+ int oldtype = LIBC_CANCEL_ASYNC ();
-+ int result = __syscall_pwrite(fd, buf, count, __LONG_LONG_PAIR(offset >> 31, offset));
-+ LIBC_CANCEL_RESET (oldtype);
-+ return result;
- }
- weak_alias(__libc_pwrite,pwrite)
-
-@@ -68,120 +73,11 @@ ssize_t __libc_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));
--}
--weak_alias(__libc_pwrite64,pwrite64)
--# endif /* __UCLIBC_HAS_LFS__ */
--#endif /* __NR_pwrite */
--
--#if ! defined __NR_pread || ! defined __NR_pwrite
--
--static ssize_t __fake_pread_write(int fd, void *buf,
-- size_t count, off_t offset, int do_pwrite)
--{
-- int save_errno;
-- ssize_t result;
-- off_t old_offset;
--
-- /* Since we must not change the file pointer preserve the
-- * value so that we can restore it later. */
-- if ((old_offset=lseek(fd, 0, SEEK_CUR)) == (off_t) -1)
-- return -1;
--
-- /* Set to wanted position. */
-- if (lseek(fd, offset, SEEK_SET) == (off_t) -1)
-- return -1;
--
-- if (do_pwrite == 1) {
-- /* Write the data. */
-- result = write(fd, buf, count);
-- } else {
-- /* Read the data. */
-- result = read(fd, buf, count);
-- }
--
-- /* Now we have to restore the position. If this fails we
-- * have to return this as an error. */
-- save_errno = errno;
-- if (lseek(fd, old_offset, SEEK_SET) == (off_t) -1)
-- {
-- if (result == -1)
-- __set_errno(save_errno);
-- return -1;
-- }
-- __set_errno(save_errno);
-- return(result);
--}
--
--# ifdef __UCLIBC_HAS_LFS__
--
--static ssize_t __fake_pread_write64(int fd, void *buf,
-- size_t count, off64_t offset, int do_pwrite)
--{
-- int save_errno;
-- ssize_t result;
-- off64_t old_offset;
--
-- /* Since we must not change the file pointer preserve the
-- * value so that we can restore it later. */
-- if ((old_offset=lseek64(fd, 0, SEEK_CUR)) == (off64_t) -1)
-- return -1;
--
-- /* Set to wanted position. */
-- if (lseek64(fd, offset, SEEK_SET) == (off64_t) -1)
-- return -1;
--
-- if (do_pwrite == 1) {
-- /* Write the data. */
-- result = write(fd, buf, count);
-- } else {
-- /* Read the data. */
-- result = read(fd, buf, count);
-- }
--
-- /* Now we have to restore the position. */
-- save_errno = errno;
-- if (lseek64(fd, old_offset, SEEK_SET) == (off64_t) -1) {
-- if (result == -1)
-- __set_errno (save_errno);
-- return -1;
-- }
-- __set_errno (save_errno);
-+ int oldtype = LIBC_CANCEL_ASYNC ();
-+ int result = __syscall_pwrite(fd, buf, count, __LONG_LONG_PAIR(high, low));
-+ LIBC_CANCEL_RESET (oldtype);
- return result;
- }
--# endif /* __UCLIBC_HAS_LFS__ */
--#endif /* ! defined __NR_pread || ! defined __NR_pwrite */
--
--#ifndef __NR_pread
--ssize_t __libc_pread(int fd, void *buf, size_t count, off_t offset)
--{
-- return __fake_pread_write(fd, buf, count, offset, 0);
--}
--weak_alias(__libc_pread,pread)
--
--# ifdef __UCLIBC_HAS_LFS__
--ssize_t __libc_pread64(int fd, void *buf, size_t count, off64_t offset)
--{
-- return __fake_pread_write64(fd, buf, count, offset, 0);
--}
--weak_alias(__libc_pread64,pread64)
--# endif /* __UCLIBC_HAS_LFS__ */
--#endif /* ! __NR_pread */
--
--#ifndef __NR_pwrite
--ssize_t __libc_pwrite(int fd, const void *buf, size_t count, off_t offset)
--{
-- /* we won't actually be modifying the buffer,
-- *just cast it to get rid of warnings */
-- return __fake_pread_write(fd, (void*)buf, count, offset, 1);
--}
--weak_alias(__libc_pwrite,pwrite)
--
--# ifdef __UCLIBC_HAS_LFS__
--ssize_t __libc_pwrite64(int fd, const void *buf, size_t count, off64_t offset)
--{
-- return __fake_pread_write64(fd, (void*)buf, count, offset, 1);
--}
- weak_alias(__libc_pwrite64,pwrite64)
- # endif /* __UCLIBC_HAS_LFS__ */
--#endif /* ! __NR_pwrite */
-+