From: c.briere@samsung.com (Charles Briere)
Subject: [lttng-dev] [PATCH lttng-tools 24/24] Android : Add splice compatibility to fcntl layer
Date: Mon, 27 Oct 2014 20:49:30 +0000 [thread overview]
Message-ID: <1414442926-14381-25-git-send-email-c.briere@samsung.com> (raw)
In-Reply-To: <1414442926-14381-1-git-send-email-c.briere@samsung.com>
From: Charles Briere <c.briere@samsung.com>
Define splice() as __NR_splice() when not available directly (happens with BIONIC)
Define SPLICE_*_* values
Signed-off-by: Charles Briere <c.briere at samsung.com>
---
configure.ac | 2 +-
src/common/compat/fcntl.h | 26 +++++++++++++++++++++++++-
2 files changed, 26 insertions(+), 2 deletions(-)
diff --git a/configure.ac b/configure.ac
index ea37ad0..7230e92 100644
--- a/configure.ac
+++ b/configure.ac
@@ -67,7 +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_DECLS([posix_fadvise, splice],[],[], [[#include <fcntl.h>]])
AC_CHECK_FUNCS([getpwuid_r],[],[])
diff --git a/src/common/compat/fcntl.h b/src/common/compat/fcntl.h
index 779c942..b3453a2 100644
--- a/src/common/compat/fcntl.h
+++ b/src/common/compat/fcntl.h
@@ -46,9 +46,33 @@ extern int compat_sync_file_range(int fd, off64_t offset, off64_t nbytes,
# include <linux/fadvise.h>
# endif
+# if !HAVE_DECL_SPLICE
+# if defined(__NR_splice)
+# define splice(fdin, off_in, fdout, off_out, len, flags) syscall(__NR_splice, fdin, off_in, fdout, off_out, len, flags)
+# endif
+# endif
+
# ifndef SYNC_FILE_RANGE_WRITE
# include <linux/fs.h>
-#endif
+# endif
+
+# ifndef SPLICE_F_MOVE
+# define SPLICE_F_MOVE 1 /* Move pages instead of copying. */
+# endif
+
+# ifndef SPLICE_F_NONBLOCK
+# define SPLICE_F_NONBLOCK 2 /* Don't block on the pipe splicing
+ (but we may still block on the fd
+ we splice from/to). */
+# endif
+
+# ifndef SPLICE_F_MORE
+# define SPLICE_F_MORE 4 /* Expect more data. */
+# endif
+
+# ifndef SPLICE_F_GIFT
+# define SPLICE_F_GIFT 8 /* Pages passed in are a gift. */
+# endif
#endif /* __linux__ */
--
2.1.2
next prev parent reply other threads:[~2014-10-27 20:49 UTC|newest]
Thread overview: 26+ messages / expand[flat|nested] mbox.gz Atom feed top
2014-10-27 20:49 [lttng-dev] Fixes for Android Charles Briere
2014-10-27 20:49 ` [lttng-dev] [PATCH lttng-tools 06/24] Fix : Do not redeclare gettid if found Charles Briere
2014-10-27 20:49 ` [lttng-dev] [PATCH lttng-tools 07/24] Fix : need to include config.h if using it's definitions Charles Briere
2014-10-27 20:49 ` [lttng-dev] [PATCH lttng-tools 05/24] Fix : Do not use gLibc specific macros Charles Briere
2014-10-27 20:49 ` [lttng-dev] [PATCH lttng-tools 08/24] Fix : Don't compile ust functions when not enabled Charles Briere
2014-10-27 20:49 ` [lttng-dev] [PATCH lttng-tools 02/24] Fix : Include sys/stat.h where needed Charles Briere
2014-10-27 20:49 ` [lttng-dev] [PATCH lttng-tools 04/24] Fix : Only link librt if available Charles Briere
2014-10-27 20:49 ` [lttng-dev] [PATCH lttng-tools 01/24] Fix : wait.h should be sys/wait.h according to posix and android doesn't redirect wait.h to sys/wait.h Charles Briere
2014-10-27 20:49 ` [lttng-dev] [PATCH lttng-tools 03/24] Fix : Wrap variable with URCU_TLS for sizeof Charles Briere
2014-10-27 20:49 ` [lttng-dev] [PATCH lttng-tools 10/24] Add : Compatibility layer for netinet/in.h Charles Briere
2014-10-27 20:49 ` [lttng-dev] [PATCH lttng-tools 17/24] Add : Compatibility layer for pthread Charles Briere
2014-10-27 20:49 ` [lttng-dev] [PATCH lttng-tools 09/24] Add : Compatibility layer for syscall.h Charles Briere
2014-10-27 20:49 ` [lttng-dev] [PATCH lttng-tools 14/24] Add : Compatibility layer for signal.h Charles Briere
2014-10-27 20:49 ` [lttng-dev] [PATCH lttng-tools 16/24] Add : Compatibility layer for pwd.h Charles Briere
2014-10-27 20:49 ` [lttng-dev] [PATCH lttng-tools 12/24] Add : Compatibility layer for ulimit.h Charles Briere
2014-10-27 20:49 ` [lttng-dev] [PATCH lttng-tools 11/24] Add : Compatibility layer for limit.h Charles Briere
2014-10-27 20:49 ` [lttng-dev] [PATCH lttng-tools 15/24] Add : Compatibility layer for stat.h Charles Briere
2014-10-27 20:49 ` [lttng-dev] [PATCH lttng-tools 13/24] Add : Compatibility layer for un.h Charles Briere
2014-10-27 20:49 ` [lttng-dev] [PATCH lttng-tools 19/24] Android : Looking for pthread in libc Charles Briere
2014-10-27 20:49 ` [lttng-dev] [PATCH lttng-tools 21/24] Android : Adding bswap defintions Charles Briere
2014-10-27 20:49 ` [lttng-dev] [PATCH lttng-tools 20/24] Android : %m[^] not supported in fscanf Charles Briere
2014-10-27 20:49 ` [lttng-dev] [PATCH lttng-tools 22/24] Android : Missing defintion in fcntl.h Charles Briere
2014-10-27 20:49 ` Charles Briere [this message]
2014-10-27 20:49 ` [lttng-dev] [PATCH lttng-tools 18/24] Add : Compatibility layer for shm.h Charles Briere
2014-10-27 20:49 ` [lttng-dev] [PATCH lttng-tools 23/24] Android : Define posix_fadvise Charles Briere
2014-10-27 20:58 ` [lttng-dev] Fixes for Android Karim Yaghmour
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=1414442926-14381-25-git-send-email-c.briere@samsung.com \
--to=c.briere@samsung.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