From mboxrd@z Thu Jan 1 00:00:00 1970 From: dgoulet@efficios.com (David Goulet) Date: Wed, 16 Jan 2013 11:02:57 -0500 Subject: [lttng-dev] [PATCH] Make sync_file_range() usage optional In-Reply-To: <1357979037-28550-1-git-send-email-s.martin49@gmail.com> References: <1357979037-28550-1-git-send-email-s.martin49@gmail.com> Message-ID: <50F6CF31.7050808@efficios.com> Merged! Thanks! David Samuel Martin: > Under uClibc, sync_file_range() is not available under all > architectures, so we fall back to fdatasync() in this case. > > Signed-off-by: Thomas Petazzoni > Signed-off-by: Samuel Martin > --- > configure.ac | 2 +- > src/common/compat/compat-fcntl.c | 4 ++++ > 2 files changed, 5 insertions(+), 1 deletion(-) > > diff --git a/configure.ac b/configure.ac > index 425941b..80940c0 100644 > --- a/configure.ac > +++ b/configure.ac > @@ -150,7 +150,7 @@ AS_IF([test "x$lttng_ust_support" = "xyes"], [ > ) > ]) > AM_CONDITIONAL([HAVE_LIBLTTNG_UST_CTL], [test "x$lttng_ust_ctl_found" = xyes]) > -AC_CHECK_FUNCS([sched_getcpu sysconf]) > +AC_CHECK_FUNCS([sched_getcpu sysconf sync_file_range]) > > # check for dlopen > AC_CHECK_LIB([dl], [dlopen], > diff --git a/src/common/compat/compat-fcntl.c b/src/common/compat/compat-fcntl.c > index 5a1c757..7ff63a3 100644 > --- a/src/common/compat/compat-fcntl.c > +++ b/src/common/compat/compat-fcntl.c > @@ -23,7 +23,11 @@ > int compat_sync_file_range(int fd, off64_t offset, off64_t nbytes, > unsigned int flags) > { > +#ifdef HAVE_SYNC_FILE_RANGE > return sync_file_range(fd, offset, nbytes, flags); > +#else > + return fdatasync(fd); > +#endif > } > > #endif /* __linux__ */