Mirror of the lttng-dev mailing list
 help / color / mirror / Atom feed
From: s.martin49@gmail.com (Samuel Martin)
Subject: [lttng-dev] [PATCH] Make sync_file_range() usage optional
Date: Sat, 12 Jan 2013 09:23:57 +0100	[thread overview]
Message-ID: <1357979037-28550-1-git-send-email-s.martin49@gmail.com> (raw)

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 <thomas.petazzoni at free-electrons.com>
Signed-off-by: Samuel Martin <s.martin49 at gmail.com>
---
 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__ */
-- 
1.8.1




             reply	other threads:[~2013-01-12  8:23 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-01-12  8:23 Samuel Martin [this message]
2013-01-13 16:48 ` Mathieu Desnoyers
2013-01-16 16:02 ` David Goulet

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1357979037-28550-1-git-send-email-s.martin49@gmail.com \
    --to=s.martin49@gmail.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox