[Android] [PATCH 5/7] jni: Use the syscall function in JNI for Android-x86

Edward Wang edward.c.wang at compdigitec.com
Sun Jul 15 22:27:32 CEST 2012


---
 vlc-android/jni/eventfd.c |   11 +++++++++++
 1 files changed, 11 insertions(+), 0 deletions(-)

diff --git a/vlc-android/jni/eventfd.c b/vlc-android/jni/eventfd.c
index b54e879..f28d075 100644
--- a/vlc-android/jni/eventfd.c
+++ b/vlc-android/jni/eventfd.c
@@ -18,11 +18,21 @@
  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301, USA.
  *****************************************************************************/
 
+#ifdef __arm__
 #include <sys/linux-syscalls.h>
+#elif defined(__i386__)
+#include <sys/syscall.h>
+#include <sys/linux-syscalls.h>
+#endif
 #include <errno.h>
 
 int eventfd(unsigned int initval, int flags)
 {
+#ifdef __i386__
+    /* The ASM below doesn't work on x86 due to missing
+     * registers and other problems */
+    return syscall(__NR_eventfd2, initval, flags);
+#elif defined(__arm__)
     int ret;
     int syscall_nr = __NR_eventfd2;
 
@@ -43,4 +53,5 @@ int eventfd(unsigned int initval, int flags)
     }
 
     return ret;
+#endif
 }
-- 
1.7.5.4



More information about the Android mailing list