aboutsummaryrefslogtreecommitdiffstats
path: root/meta/recipes-core/uclibc/uclibc-0.9.32/sync_file_range2.patch
blob: 4b85a43e8a9a82b6d82db8de078059dbf656737f (plain)
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
Some architectures like ppc, arm use aligned 64 bit inputs so a register is not wasted
this then uses __NR_sync_file_range2 syscall. Implement is

Singed-off-by: Khem Raj <raj.khem@gmail.com>

Upstream-Status: Pending

Index: git/libc/sysdeps/linux/common/sync_file_range.c
===================================================================
--- git.orig/libc/sysdeps/linux/common/sync_file_range.c	2011-07-19 14:23:35.000000000 -0700
+++ git/libc/sysdeps/linux/common/sync_file_range.c	2011-07-19 15:04:38.631808666 -0700
@@ -11,7 +11,8 @@
 #if defined __USE_GNU
 #include <fcntl.h>
 
-#if defined __NR_sync_file_range && defined __UCLIBC_HAS_LFS__
+#if defined __UCLIBC_HAS_LFS__
+#if defined __NR_sync_file_range
 #define __NR___syscall_sync_file_range __NR_sync_file_range
 static __inline__ _syscall6(int, __syscall_sync_file_range, int, fd,
 		off_t, offset_hi, off_t, offset_lo,
@@ -23,5 +24,23 @@
 		__LONG_LONG_PAIR((long)(nbytes >> 32), (long)(nbytes & 0xffffffff)),
 		flags);
 }
-#endif
-#endif
+#elif defined __NR_sync_file_range2
+#define __NR___syscall_sync_file_range2 __NR_sync_file_range2
+static __inline__ _syscall6(int, __syscall_sync_file_range2, int, fd,
+		unsigned int, flags, off_t, offset_hi, off_t, offset_lo,
+		off_t, nbytes_hi, off_t, nbytes_lo)
+int sync_file_range(int fd, off64_t offset, off64_t nbytes, unsigned int flags)
+{
+	return __syscall_sync_file_range2(fd, flags,
+		__LONG_LONG_PAIR((long)(offset >> 32), (long)(offset & 0xffffffff)),
+		__LONG_LONG_PAIR((long)(nbytes >> 32), (long)(nbytes & 0xffffffff)));
+}
+#else
+int sync_file_range(int fd, off64_t offset, off64_t nbytes, unsigned int flags)
+{
+	__set_errno (ENOSYS);
+	return -1
+}
+#endif /* __NR_sync_file_range */
+#endif /* __UCLIBC_HAS_LFS__ */
+#endif /* __USE_GNU */