[lttng-dev] [PATCH lttng-tools 23/24] Android : Define posix_fadvise

Charles Briere c.briere at samsung.com
Mon Oct 27 16:49:30 EDT 2014


From: Charles Briere <c.briere at samsung.com>

Mapping from __NR_arm_fadvise64_64  to posix_fadvise
is not done within BIONIC

Signed-off-by: Charles Briere <c.briere at samsung.com>
---
 configure.ac              | 1 +
 src/common/compat/fcntl.h | 6 ++++++
 2 files changed, 7 insertions(+)

diff --git a/configure.ac b/configure.ac
index 91efd17..ea37ad0 100644
--- a/configure.ac
+++ b/configure.ac
@@ -67,6 +67,7 @@ AC_CHECK_TYPES([in_port_t], [], [], [[#include <netinet/in.h>]])
 
 AC_CHECK_DECLS([sigwaitinfo],[],[], [[#include <signal.h>]])
 AC_CHECK_DECLS([pthread_cancel], [], [], [[#include <pthread.h>]])
+AC_CHECK_DECLS([posix_fadvise],[],[], [[#include <fcntl.h>]])
 
 AC_CHECK_FUNCS([getpwuid_r],[],[])
 
diff --git a/src/common/compat/fcntl.h b/src/common/compat/fcntl.h
index 1325a3f..779c942 100644
--- a/src/common/compat/fcntl.h
+++ b/src/common/compat/fcntl.h
@@ -36,6 +36,12 @@ extern int compat_sync_file_range(int fd, off64_t offset, off64_t nbytes,
 #define lttng_sync_file_range(fd, offset, nbytes, flags) \
 	compat_sync_file_range(fd, offset, nbytes, flags)
 
+# if !HAVE_DECL_POSIX_FADVISE
+#  if defined(__NR_arm_fadvise64_64)
+#   define posix_fadvise(fd, offset, len, advise) syscall(__NR_arm_fadvise64_64, fd, offset, len, advise)
+#  endif
+# endif
+
 # ifndef POSIX_FADV_DONTNEED
 #  include <linux/fadvise.h>
 # endif
-- 
2.1.2



More information about the lttng-dev mailing list