RE: syscall problem on Android x86

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Unfortunately android x86 doesn't have a syscall number for the shm* functions. They are not exposed by x86 bionic libc. So there's nothing to fill in for a/b/c/d.

The only way I see to get syscall numbers is to patch x86 android libc and recompile. This should work for me today but, since the syscall numbers are not standardized, it will not work for anyone with an unmodified libc.

So I propose something like:

#ifndef __NR_shmget
#if defined(__ANDROID__)
#error "__NR_shmget not defined. See bionic libc SYSCALLS.TXT for more information."
#else
#define __NR_shmget		 29
#define __NR_shmat		 30
#define __NR_shmctl		 31
#define __NR_shmdt		 67
#endif
#endif

This will "break the build" for unmodified x86 android platforms, but I think that's better than compiling and not working.

The other (probably better long-term) option is to use ashmem for allocating shared memory on android.

Jason Akers


-----Original Message-----
From: fio-owner@xxxxxxxxxxxxxxx [mailto:fio-owner@xxxxxxxxxxxxxxx] On Behalf Of Jens Axboe
Sent: Friday, April 26, 2013 1:04 PM
To: Akers, Jason B
Cc: fio@xxxxxxxxxxxxxxx
Subject: Re: syscall problem on Android x86

On Fri, Apr 26 2013, Akers, Jason B wrote:
> Hi Jens,
> 
> Sorry for the confusion. I'm building for x86 Android, not arm.
> 
> The issue is that Android x86 does not define __NR_shmget. And the 
> fact that it's hardcoded to 29 in arch-x86.h is causing problems. On
> x86 Android syscall 29 is actually the sys_pause() function.
> Therefore, fio compiles but it just pauses when shmget() is called.

Ah I see, so android x86  You could hack around it a little bit. In arch-x86.h, something ala:

#ifndef __NR_shmget
#if defined(__ANDROID__)
#define __NR_shmget		 a
#define __NR_shmat		 b
#define __NR_shmctl		 c
#define __NR_shmdt		 d
#else
#define __NR_shmget		 29
#define __NR_shmat		 30
#define __NR_shmctl		 31
#define __NR_shmdt		 67
#endif
#endif

with a/b/c/d being the right values for the android abi.

--
Jens Axboe

--
To unsubscribe from this list: send the line "unsubscribe fio" in the body of a message to majordomo@xxxxxxxxxxxxxxx More majordomo info at  http://vger.kernel.org/majordomo-info.html
--
To unsubscribe from this list: send the line "unsubscribe fio" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html




[Index of Archives]     [Linux Kernel]     [Linux SCSI]     [Linux IDE]     [Linux USB Devel]     [Video for Linux]     [Linux Audio Users]     [Yosemite News]     [Linux SCSI]

  Powered by Linux