summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--meta/recipes-devtools/dpkg/dpkg/glibc2.5-sync_file_range.patch86
-rw-r--r--meta/recipes-devtools/dpkg/dpkg_1.17.4.bb1
2 files changed, 87 insertions, 0 deletions
diff --git a/meta/recipes-devtools/dpkg/dpkg/glibc2.5-sync_file_range.patch b/meta/recipes-devtools/dpkg/dpkg/glibc2.5-sync_file_range.patch
new file mode 100644
index 0000000000..d56b8a69a3
--- /dev/null
+++ b/meta/recipes-devtools/dpkg/dpkg/glibc2.5-sync_file_range.patch
@@ -0,0 +1,86 @@
1CentOS 5.8 kernels and headers support the sync_file_range() system call,
2but glibc 2.5 doesn't provide the syscall stub. It appears that this
3problem is known but will never be fixed:
4
5 https://bugzilla.redhat.com/show_bug.cgi?id=518581
6
7 Bug 518581 - [RHEL5] glibc misses sync_file_range syscall interface
8
9 Status: CLOSED CANTFIX
10 Last Closed: 2009-11-22 22:19:55
11
12 Kirby Zhou 2009-08-20 23:37:55 EDT
13
14 Description of problem:
15
16 glibc misses sync_file_range syscall interface. The header file and
17 man page both say 'sync_file_range' should exist. From man page,
18 sync_file_range should exist sinc kernel-2.6.17
19
20 Andreas Schwab 2009-08-21 03:24:24 EDT
21
22 It has only been added to glibc 2.6, and cannot be backported due to
23 ABI breakage. You can always fall back to syscall(3).
24
25 Ulrich Drepper 2009-11-22 22:19:55 EST
26
27 As comment #1 says, no chance to backport this.
28
29 See the syscall man page for instructions.
30
31 Jon E 2010-03-19 10:32:37 EDT
32
33 then why document it if it's broken and you're not going to fix it?
34 .. might want to FTFM over at sync_file_range(2) - in the meantime -
35 borrowing from glibc 2.6 .. any thoughts on this implementation for a
36 hacky workaround for those still on your "ancient releases" .. (eg:
37 RHEL5.3)?:
38
39 #ifdef ULI_WONT_FIX_THIS_IN_GLIBC2.5
40 #define NR_sync_file_range 277
41 int sync_file_range (int fd, __off64_t from, __off64_t to, unsigned int flags)
42 {
43 return syscall (NR_sync_file_range, fd,
44 __LONG_LONG_PAIR ((long) (from >> 32), (long) from),
45 __LONG_LONG_PAIR ((long) (to >> 32), (long) to),
46 flags);
47 }
48 #endif
49
50 assuming of course that you're on an x86_64 and include/asm-
51 x86_64/unistd.h has the correct entry
52
53 (fwiw - fio is starting to use this now)
54
55Rather than attempting to provide an implementation using syscall(),
56we take the more conservative route and ignore header support for
57sync_file_range() flags when the glibc version is <= 2.5.
58
59Upstream-Status: Inappropriate [everyone else builds on newer hosts :-)]
60
61Signed-off-by: Donn Seeley <donn.seeley@windriver.com>
62Signed-off-by: Lei Liu <lei.liu2@windriver.com>
63---
64 src/archives.c | 4 ++--
65 1 file changed, 2 insertions(+), 2 deletions(-)
66
67--- a/src/archives.c
68+++ b/src/archives.c
69@@ -75,7 +75,7 @@
70 /* Ignore the return code as it should be considered equivalent to an
71 * asynchronous hint for the kernel, we are doing an fsync() later on
72 * anyway. */
73-#if defined(SYNC_FILE_RANGE_WRITE)
74+#if defined(SYNC_FILE_RANGE_WRITE) && __GLIBC_PREREQ(2, 6)
75 sync_file_range(fd, 0, 0, SYNC_FILE_RANGE_WRITE);
76 #elif defined(HAVE_POSIX_FADVISE)
77 posix_fadvise(fd, 0, 0, POSIX_FADV_DONTNEED);
78@@ -1179,7 +1179,7 @@
79 return 0;
80 }
81
82-#if defined(SYNC_FILE_RANGE_WAIT_BEFORE)
83+#if defined(SYNC_FILE_RANGE_WAIT_BEFORE) && __GLIBC_PREREQ(2, 6)
84 static void
85 tar_writeback_barrier(struct fileinlist *files, struct pkginfo *pkg)
86 {
diff --git a/meta/recipes-devtools/dpkg/dpkg_1.17.4.bb b/meta/recipes-devtools/dpkg/dpkg_1.17.4.bb
index b27e6f450e..5e407ba2b2 100644
--- a/meta/recipes-devtools/dpkg/dpkg_1.17.4.bb
+++ b/meta/recipes-devtools/dpkg/dpkg_1.17.4.bb
@@ -10,6 +10,7 @@ SRC_URI += "file://noman.patch \
10 file://fix-abs-redefine.patch \ 10 file://fix-abs-redefine.patch \
11 file://arch_pm.patch \ 11 file://arch_pm.patch \
12 file://dpkg-configure.service \ 12 file://dpkg-configure.service \
13 file://glibc2.5-sync_file_range.patch \
13 " 14 "
14 15
15SRC_URI[md5sum] = "cc25086e1e3bd9512a95f14cfe9002e1" 16SRC_URI[md5sum] = "cc25086e1e3bd9512a95f14cfe9002e1"