Location for named pipes (mkfifo)

1,664 views
Skip to first unread message

Ignas

unread,
May 1, 2010, 6:55:11 AM5/1/10
to android-ndk
Hello experts!

Consider this: two or more applications want to communicate over named
pipes (mkfifo), is there a recommended location on Android filesystem
to create the named pipe?

So far, I know:
-- that OS would not permit mkfifo anywhere on /sdcard
-- that it is possible to create a pipe in /data/data/<main class
name>, but the very need to know the class name is a no go because
application is ported from other OS and it would require a design
change to poke a hole and allow initial access
-- OS allowed me create a pipe in /sqlite_stmt_journals, but is it
"legal" to do it there? Are there any downsides for that?

I assume there must be a need for this kind of temporary exchange.
Named pipes is just one of them. Lock files, Unix domain sockets and
probably just about anything inter-process in Linux would require this
kind of location. Considering that the purpose of NDK is to allow
porting of existing codebase, there should be such location...

Thanks,
Ignas

--
You received this message because you are subscribed to the Google Groups "android-ndk" group.
To post to this group, send email to andro...@googlegroups.com.
To unsubscribe from this group, send email to android-ndk...@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/android-ndk?hl=en.

David Turner

unread,
May 1, 2010, 6:00:30 PM5/1/10
to andro...@googlegroups.com
On Sat, May 1, 2010 at 3:55 AM, Ignas <ignas.li...@gmail.com> wrote:
Hello experts!

Consider this: two or more applications want to communicate over named
pipes (mkfifo), is there a recommended location on Android filesystem
to create the named pipe?

So far, I know:
 -- that OS would not permit mkfifo anywhere on /sdcard

Definitely. And you don't want a FIFO on something that can easily be removed by the user.
 
 -- that it is possible to create a pipe in /data/data/<main class
name>, but the very need to know the class name is a no go because
application is ported from other OS and it would require a design
change to poke a hole and allow initial access

There lies your problem I think. Why don't you use the default Android IPC mechanism
from Java (e.g. Binder).

 -- OS allowed me create a pipe in /sqlite_stmt_journals, but is it
"legal" to do it there? Are there any downsides for that?

This is not supported, which really means that there is no guarantee that this will
work on all Android devices, now or in the future.
 
I assume there must be a need for this kind of temporary exchange.
Named pipes is just one of them. Lock files, Unix domain sockets and
probably just about anything inter-process in Linux would require this
kind of location. Considering that the purpose of NDK is to allow
porting of existing codebase, there should be such location...

No, the purpose of the NDK is to allow you to use native code for performance reasons in your applications.

Porting existing codebase is a side-effect but there is no guarantee that every Linux source code under the
sun can easily be recompiled.
 
There is no native API to do what you want reliably. I recommend using the VM to perform IPCs instead.

Thanks,
Ignas

--
You received this message because you are subscribed to the Google Groups "android-ndk" group.
To post to this group, send email to andro...@googlegroups.com.
To unsubscribe from this group, send email to android-ndk...@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/android-ndk?hl=en.

Reply all
Reply to author
Forward
0 new messages