Why was bionic/libc/include/sys/shm.h removed?

3,958 views
Skip to first unread message

Sean McNeil

unread,
Mar 20, 2009, 10:18:46 PM3/20/09
to android...@googlegroups.com
In fact all of the routines are gone such as shmat(). How come?

Jean-Baptiste Queru

unread,
Mar 20, 2009, 10:25:29 PM3/20/09
to android...@googlegroups.com
From our internal revision control system:

---8<---
Remove support for System V IPCs in our C library.

This is done to avoid potential nasty denial of service that may
require rebooting the phone. For more details, see the new file
named docs/SYSV-IPC.TXT
---8<---

JBQ

2009/3/20 Sean McNeil <seanm...@gmail.com>:
>
> In fact all of the routines are gone such as shmat(). How come?
>
>
> >
>



--
Jean-Baptiste M. "JBQ" Queru
Android Engineer, Google.

Questions sent directly to me that have no reason for being private
will likely get ignored or forwarded to a public forum with no further
warning.

muddog

unread,
Mar 24, 2009, 9:55:21 PM3/24/09
to android-porting

On 3月21日, 上午10时25分, Jean-Baptiste Queru <j...@android.com> wrote:
> From our internal revision control system:
>
> ---8<---
> Remove support for System V IPCs in our C library.
>
> This is done to avoid potential nasty denial of service that may
> require rebooting the phone. For more details, see the new file
> named docs/SYSV-IPC.TXT
> ---8<---

So, how about platform/external/alsa-lib? It use shmat().
Need porting all SysV share memory calling to ashmem?

>
> JBQ
>
> 2009/3/20 Sean McNeil <seanmcne...@gmail.com>:

Jean-Baptiste Queru

unread,
Mar 24, 2009, 9:57:56 PM3/24/09
to android...@googlegroups.com
Very sorry, I have no visibility over that.

JBQ

2009/3/24 muddog <mudd...@gmail.com>:

Girish

unread,
Mar 24, 2009, 10:59:41 PM3/24/09
to android-porting
Hi,

In cupcake (or any other branch) system V message queue wont be
supported what ? What is the reason for removing them ? Is there any
alternative for this ?

Regards
Girish



On Mar 25, 6:57 am, Jean-Baptiste Queru <j...@android.com> wrote:
> Very sorry, I have no visibility over that.
>
> JBQ
>
> 2009/3/24 muddog <muddo...@gmail.com>:

Androidphan

unread,
Mar 25, 2009, 3:49:30 AM3/25/09
to android-porting

Girish

unread,
Mar 25, 2009, 4:34:23 AM3/25/09
to android-porting
For ARM is this available or removed is my doubt.

The patch talks of "Add missed IPC syscalls for x86"

Regards
Girish

David Turner

unread,
Mar 25, 2009, 5:24:33 AM3/25/09
to android...@googlegroups.com


2009/3/25 Girish <htgi...@gmail.com>


Hi,

In cupcake (or any other branch) system V message queue wont be
supported what ? What is the reason for removing them ? Is there any
alternative for this ?

Yes, all System V IPCs have been removed for cupcake. See bionic/libc/docs/SYSV-IPC.TXT for details.

In brief, System V IPCs are leaky by design and do not play well in Android's runtime environment where
killing processes to make room for other ones is just normal and very common. The end result is that any
code that relies on these IPCs could end up filling up the kernel's internal table of SysV IPC keys, something
that can only safely be resolved by a reboot.

We want to provide alternative mechanism in the future that don't have the same problems. One thing
we provide at the moment is ashmem, which was designed specifically for Android to avoid that kind of
problem (though it's not as well documented as it should). We probably need something similar for
semaphores and/or message queues.

Note that PTHREAD_SHARED Posix mutexes don't have this problem, because they are cleaned up
automatically when a process is killed by the kernel. However, we do not support them yet in our
Pthread implementation.

 

David Turner

unread,
Mar 25, 2009, 5:25:03 AM3/25/09
to android...@googlegroups.com
On Wed, Mar 25, 2009 at 9:34 AM, Girish <htgi...@gmail.com> wrote:

For ARM is this available or removed is my doubt.

The patch talks of "Add missed IPC syscalls for x86"

Note that there is no guarantee that the syscalls will be supported by the Android kernel though
 

Regards
Girish


Girish

unread,
Mar 25, 2009, 8:36:07 PM3/25/09
to android-porting
Is this ashmem can be used for inter thread communication also ? Is it
similar to system V message queues ? Where can i find the
documentation on this ? Any examples would be helpful.

Regards
Girish

David Turner

unread,
Mar 25, 2009, 8:55:05 PM3/25/09
to android...@googlegroups.com
ashmem only deals with shared memory buffers.

There is no proper documentation about them as far as I know at the moment :-(

Girish

unread,
Mar 25, 2009, 9:02:23 PM3/25/09
to android-porting
Is there any other alternative for inter thread communication
mechanism supported by android ? what about the current native apps
which may (my guess) be using message queues ? how are they going to
be replaced.

Suggest some other alternative mechanism.

Girish

Dianne Hackborn

unread,
Mar 25, 2009, 9:39:34 PM3/25/09
to android...@googlegroups.com
We mostly use Binder for inter-process communication.
--
Dianne Hackborn
Android framework engineer
hac...@android.com

Note: please don't send private questions to me, as I don't have time to provide private support.  All such questions should be posted on public forums, where I and others can see and answer them.

Girish

unread,
Mar 25, 2009, 10:09:48 PM3/25/09
to android-porting
Can you tell in particular which native c application (open_src/
external) uses binder IPC ?

Girish

Dianne Hackborn

unread,
Mar 26, 2009, 12:11:33 AM3/26/09
to android...@googlegroups.com
All of the stuff I write with it uses the C++ API, so sorry no.  Maybe somebody else can.

Girish

unread,
Mar 26, 2009, 1:25:26 AM3/26/09
to android-porting
Can you tell me the file i look into for using binder ipcs ?
are these similar to message queues ?

Girish

Dianne Hackborn

unread,
Mar 26, 2009, 1:34:12 AM3/26/09
to android...@googlegroups.com
There has been a fair amount of discussion about it on android-platform, such as:

http://groups.google.com/group/android-platform/browse_thread/thread/532f2ec1d17eadf/5cb6a1491fb23274

susanner

unread,
Mar 26, 2009, 3:29:14 AM3/26/09
to android-porting
I am compiling ALSA, and it says
external/alsa-lib/src/shmarea.c:27:21: error: sys/shm.h: No such file
or directory
what should I do now?

On 3月21日, 上午10时25分, Jean-Baptiste Queru <j...@android.com> wrote:
> From our internal revision control system:
>
> ---8<---
> Remove support for System V IPCs in our C library.
>
> This is done to avoid potential nasty denial of service that may
> require rebooting the phone. For more details, see the new file
> named docs/SYSV-IPC.TXT
> ---8<---
>
> JBQ
>
> 2009/3/20 Sean McNeil <seanmcne...@gmail.com>:

kd.itbhu

unread,
Mar 26, 2009, 3:37:16 AM3/26/09
to android-porting
Can anybody please tell me the list of API available for IPC...
Thanks and regards
Kuldeep

susanner

unread,
Mar 26, 2009, 5:21:58 AM3/26/09
to android...@googlegroups.com

I replaced the whole bionic/libc with former version android.
After I successfully build alsa , I found there are problems with opencore and are seemingly relevant to A-V sync, I am trying to solve the problem.
Anybody any ideas?

网易邮箱,中国第一大电子邮件服务商
Reply all
Reply to author
Forward
0 new messages