1 Make sync_file_range() usage optional
3 Under uClibc, sync_file_range() is not available under all
4 architectures, so we fall back to fdatasync() in this case.
6 Inspired by the patch done by Thomas Petazzoni for the
9 Signed-off-by: Samuel Martin <s.martin49@gmail.com>
12 src/common/compat/fcntl.h | 5 +++++
13 2 files changed, 6 insertions(+), 1 deletion(-)
17 @@ -150,7 +150,7 @@ AS_IF([test "x$lttng_ust_support" = "xye
20 AM_CONDITIONAL([HAVE_LIBLTTNG_UST_CTL], [test "x$lttng_ust_ctl_found" = xyes])
21 -AC_CHECK_FUNCS([sched_getcpu sysconf])
22 +AC_CHECK_FUNCS([sched_getcpu sysconf sync_file_range])
25 AC_CHECK_LIB([dl], [dlopen],
26 @@ -394,4 +394,3 @@ AS_IF([test "x$consumerd_only" = "xno"],
31 --- a/src/common/compat/compat-fcntl.c
32 +++ b/src/common/compat/compat-fcntl.c
34 int compat_sync_file_range(int fd, off64_t offset, off64_t nbytes,
37 +#ifdef HAVE_SYNC_FILE_RANGE
38 return sync_file_range(fd, offset, nbytes, flags);
40 + return fdatasync(fd);
44 #endif /* __linux__ */