On 16/09/2015 11:28, Houcheng Lin wrote:
> 2015-09-16 16:09 GMT+08:00 Paolo Bonzini <[email protected]>:
>>
>>
>>>
>>> I'll modify the bionic C library to support these functions and feedback
>>> to google's AOSP project. But the android kernel does not support shmem,
>>
>> It doesn't support tmpfs? /dev/shm is just a tmpfs.
>>
>> Paolo
>
> Oh, you are right. The android have shmget, shmat, shmdt functions in
> their libc. The POSIX shm_open can built on top of these. I'll fix my
> libc to support posix share memory functions.
Actually it's even simpler. shm_open is basically just
char *s;
int fd;
asprintf(&s, "/dev/shm/%s", name);
fd = open(s, name | O_CLOEXEC, mode);
free(s);
return fd;
plus some error checking. Do Android systems have /dev/shm?
Paolo