[vlc-commits] android: Implement pipe2

Rafaël Carré git at videolan.org
Tue Sep 6 00:01:03 CEST 2011


vlc | branch: master | Rafaël Carré <rafael.carre at gmail.com> | Mon Sep  5 10:00:03 2011 +0200| [ce3960e889c249019ec5d4d144373f87be0be456] | committer: Rafaël Carré

android: Implement pipe2

> http://git.videolan.org/gitweb.cgi/vlc.git/?a=commit;h=ce3960e889c249019ec5d4d144373f87be0be456
---

 src/posix/filesystem.c |   14 ++++++++++++++
 1 files changed, 14 insertions(+), 0 deletions(-)

diff --git a/src/posix/filesystem.c b/src/posix/filesystem.c
index 3347496..f7c769d 100644
--- a/src/posix/filesystem.c
+++ b/src/posix/filesystem.c
@@ -374,6 +374,20 @@ int vlc_dup (int oldfd)
     return newfd;
 }
 
+#ifdef __ANDROID__ /* && we support android < 2.3 */
+/* pipe2() is declared and available since android-9 NDK,
+ * although it is available in libc.a since android-3
+ * We redefine the function here in order to be able to run
+ * on versions of Android older than 2.3
+ */
+#include <sys/syscall.h>
+//#include <sys/linux-syscalls.h> // fucking brokeness
+int pipe2(int fds[2], int flags)
+{
+    return syscall(/*__NR_pipe2 */ 359, fds, flags);
+}
+#endif /* __ANDROID__ */
+
 /**
  * Creates a pipe (see "man pipe" for further reference).
  */



More information about the vlc-commits mailing list