How to create named pipe (mkfifo) in Android?

后端 未结 5 1844
南方客
南方客 2020-12-13 07:35

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         


        
5条回答
  •  南方客
    南方客 (楼主)
    2020-12-13 07:57

    The default filesystem of /sdcard is FAT32, which doesn't support named pipes.

    On a non-rooted device the only possible place you could try to create those pipes would be the application data directory /data/data/com.example/ . Note: You shouldn't hardcode that value, use the Context.getApplicationInfo().dataDir .

    But be aware that whenever the user is using Apps2SD or whenever Google implements that support officially you need to make sure to let the user know that the app can't be stored on vfat files system.

提交回复
热议问题