[Android] jni: Use the syscall function in JNI for all Android archs
Edward Wang
git at videolan.org
Mon Jul 23 16:30:47 CEST 2012
android | branch: master | Edward Wang <edward.c.wang at compdigitec.com> | Sun Jul 22 23:56:22 2012 -0400| [22308943c3df00c2cb6aa6a2f433e9cf8ef6a569] | committer: Rafaël Carré
jni: Use the syscall function in JNI for all Android archs
It is better to use the syscall function instead of ASM for portability.
Signed-off-by: Rafaël Carré <funman at videolan.org>
> http://git.videolan.org/gitweb.cgi/android.git/?a=commit;h=22308943c3df00c2cb6aa6a2f433e9cf8ef6a569
---
vlc-android/jni/eventfd.c | 22 ++--------------------
1 file changed, 2 insertions(+), 20 deletions(-)
diff --git a/vlc-android/jni/eventfd.c b/vlc-android/jni/eventfd.c
index 4c08612..7ad8c7e 100644
--- a/vlc-android/jni/eventfd.c
+++ b/vlc-android/jni/eventfd.c
@@ -19,29 +19,11 @@
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301, USA.
*****************************************************************************/
+#include <sys/syscall.h>
#include <sys/linux-syscalls.h>
#include <errno.h>
int eventfd(unsigned int initval, int flags)
{
- int ret;
- int syscall_nr = __NR_eventfd2;
-
- asm(
- "mov r0, %[initval] \n\t"
- "mov r1, %[flags] \n\t"
- "mov r7, %[nr] \n\t"
- "svc #0 \n\t"
- "mov %[ret], r0 \n\t"
- : [ret] "=r" (ret)
- : [initval] "r" (initval), [flags] "r" (flags), [nr] "r" (syscall_nr)
- : "r7"
- );
-
- if (ret < 0) {
- errno = -ret;
- return -1;
- }
-
- return ret;
+ return syscall(__NR_eventfd2, initval, flags);
}
More information about the Android
mailing list