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

Edward Wang edward.c.wang at compdigitec.com
Tue Jul 17 22:34:18 CEST 2012


On 12-07-17 04:32 PM, Rafaël Carré <funman at videolan.org> wrote:
> 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
>>   }
>>
So I guess you want me to generalize and use syscall() for all Android 
archs then?

Regards,
         Edward Wang


More information about the Android mailing list