[Android] [PATCH 5/7] jni: Use the syscall function in JNI for Android-x86
Rafaël Carré
funman at videolan.org
Tue Jul 17 22:32:48 CEST 2012
Le 2012-07-15 22:27, Edward Wang a écrit :
> ---
> vlc-android/jni/eventfd.c | 11 +++++++++++
> 1 files changed, 11 insertions(+), 0 deletions(-)
I don't remember why I used asm() :/
Perhaps I didn't find the syscall() function?
>
> 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
> }
>
More information about the Android
mailing list