[PATCH 1/3] Add fadvise interface wrapper

Ben Gamari bgamari.foss at gmail.com
Fri Feb 17 17:54:09 MST 2012

With recent discussion on the LKML[1], it seems likely that Linux will
finally support posix_fadvise in a useful way with the FADV_DONTNEED
flag. This should allow us to minimize the effect of rsync on the
system's working set. Add the necessary wrapper to syscall.c.

[1] http://lkml.org/lkml/2010/11/21/59
 syscall.c |   11 +++++++++++
 1 files changed, 11 insertions(+), 0 deletions(-)

diff --git a/syscall.c b/syscall.c
index c85f73e..bec9ca8 100644
--- a/syscall.c
+++ b/syscall.c
@@ -28,6 +28,7 @@
 #include <sys/attr.h>
+#include <fcntl.h>
 extern int dry_run;
 extern int am_root;
@@ -374,3 +375,13 @@ int do_utime(const char *fname, time_t modtime, UNUSED(uint32 mod_nsec))
 #error Need utimes or utime function.
+#if _XOPEN_SOURCE >= 600
+int do_fadvise(int fd, OFF_T offset, OFF_T len, int advise)
+        return posix_fadvise(fd, offset, len, advise);
+#define do_fadvise() 

More information about the rsync mailing list