]> git.sesse.net Git - vlc/commitdiff
android: Implement pipe2
authorRafaël Carré <rafael.carre@gmail.com>
Mon, 5 Sep 2011 08:00:03 +0000 (10:00 +0200)
committerRafaël Carré <funman@videolan.org>
Mon, 5 Sep 2011 22:00:54 +0000 (00:00 +0200)
src/posix/filesystem.c

index 3347496a78d78552f650fdc3488038e10bcda4ee..f7c769d5c17dade9d69d9f03059fece5ad6f112b 100644 (file)
@@ -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).
  */