1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
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
|