How to create named pipe (mkfifo) in Android?
Posted
by Ignas Limanauskas
on Stack Overflow
See other posts from Stack Overflow
or by Ignas Limanauskas
Published on 2010-04-29T19:46:11Z
Indexed on
2010/05/02
23:48 UTC
Read the original article
Hit count: 449
android
|android-ndk
I am having trouble in creating named pipe in Android and the example below illustrates my dilemma:
res = mkfifo("/sdcard/fifo9000", S_IRWXO);
if (res != 0)
{
LOG("Error while creating a pipe (return:%d, errno:%d)", res, errno);
}
The code always prints:
Error while creating a pipe (return:-1, errno:1)
I can't figure out exactly why this fails. The application has android.permission.WRITE_EXTERNAL_STORAGE permissions. I can create normal files with exactly the same name in the same location, but pipe creation fails. The pipe in question should be accessible from multiple applications.
- I suspect that noone can create pipes in /sdcard. Where would it be the best location to do so?
- What mode mast should I set (2nd parameter)?
- Does application need any extra permissions?
© Stack Overflow or respective owner