uClibc: 0.9.33.2: Unbreak on avr32 after recent pread patches
authorPeter Korsgaard <peter@korsgaard.com>
Fri, 4 Oct 2013 19:42:44 +0000 (21:42 +0200)
committerPeter Korsgaard <peter@korsgaard.com>
Fri, 4 Oct 2013 19:42:44 +0000 (21:42 +0200)
avr32 only provides __NR_pread and not __NR_pread64, so the fallback
handling must be used.

Patch sent upstream:
http://lists.uclibc.org/pipermail/uclibc/2013-October/047967.html

Signed-off-by: Peter Korsgaard <peter@korsgaard.com>
package/uclibc/0.9.33.2/uclibc-0054-common-pread_write.c-unbreak-on-archs-without-__NR_p.patch [new file with mode: 0644]

diff --git a/package/uclibc/0.9.33.2/uclibc-0054-common-pread_write.c-unbreak-on-archs-without-__NR_p.patch b/package/uclibc/0.9.33.2/uclibc-0054-common-pread_write.c-unbreak-on-archs-without-__NR_p.patch
new file mode 100644 (file)
index 0000000..b071493
--- /dev/null
@@ -0,0 +1,36 @@
+From 1f7602f1dde43b12bead54433934ae4ddefa8118 Mon Sep 17 00:00:00 2001
+From: Peter Korsgaard <peter@korsgaard.com>
+Date: Fri, 4 Oct 2013 21:09:09 +0200
+Subject: [PATCH-0.9.33] common/pread_write.c: unbreak on archs without __NR_pread64
+
+Some archs (avr32 in particular) still doesn't define __NR_pread64, so
+we should fall back to __NR_pread if it isn't available.
+
+The code nicely checks for it, but then ends up hard coding the syscall
+to use __NR_pread64 afterwards, rendering the check useless. Fix it by
+using the result of the test instead.
+
+Signed-off-by: Peter Korsgaard <peter@korsgaard.com>
+---
+Noticed when adding the pending patches for 0.9.33.3 to Buildroot:
+http://jenkins.free-electrons.com/job/buildroot/config=atstk100x_defconfig/116/console
+
+ libc/sysdeps/linux/common/pread_write.c |    2 +-
+ 1 file changed, 1 insertion(+), 1 deletion(-)
+
+diff --git a/libc/sysdeps/linux/common/pread_write.c b/libc/sysdeps/linux/common/pread_write.c
+index b13de66..8562ab4 100644
+--- a/libc/sysdeps/linux/common/pread_write.c
++++ b/libc/sysdeps/linux/common/pread_write.c
+@@ -42,7 +42,7 @@ extern __typeof(pwrite64) __libc_pwrite64;
+ #include <bits/kernel_types.h>
+-# define __NR___syscall_pread __NR_pread64
++# 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)
+-- 
+1.7.10.4
+