From: Samuel Martin Date: Sat, 12 Jan 2013 08:23:57 +0000 (+0100) Subject: Make sync_file_range() usage optional X-Git-Tag: v2.2.0-rc1~114 X-Git-Url: https://git.lttng.org/?p=lttng-tools.git;a=commitdiff_plain;h=281047b8a004f2c2d9aea14f7e58166d0cd93775;ds=sidebyside Make sync_file_range() usage optional 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 Signed-off-by: David Goulet --- diff --git a/configure.ac b/configure.ac index 857e8e9fc..91e76f06a 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 5a1c757b8..7ff63a3a1 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__ */