[vlc-devel] [PATCH] android: Implement pipe2

Rafaël Carré rafael.carre at gmail.com
Mon Sep 5 10:00:03 CEST 2011


---
 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..f3a4c6b 100644
--- a/src/posix/filesystem.c
+++ b/src/posix/filesystem.c
@@ -374,6 +374,20 @@ int vlc_dup (int oldfd)
     return newfd;
 }
 
+#ifdef __ANDROID__
+/* pipe2() is declared and available since android-9,
+ * 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).
  */
-- 
1.7.5.4





More information about the vlc-devel mailing list