Opened 8 years ago

Last modified 5 years ago

#10047 new Feature Requests

Using Boost:Interprocess on Android

Reported by: anonymous Owned by: Ion Gaztañaga
Milestone: To Be Determined Component: interprocess
Version: Boost 1.53.0 Severity: Problem
Keywords: Android message_queue Cc:

Description

It is not a bug, but it might safe some time to others using boost:interprocess library on Android.

This library usually uses a temporary directory to store the data that is being shared among processes. The directory path used for this can be found on os_file_functions.hpp-:get_temporary_path.

The thing is that if you do not modify this file and add ´/sdcard´ to the possible paths that your process can use, then you cannot share information among android Apps due to the permission restrictions that exist for processes on android storing data outside their sandbox.

It will be a good feature to have boost compile with this option on. Or provide a static method to add my own Temporary Path.

Note: I am not completely sure if something exists to solve this problem.

Regards,

Change History (3)

comment:1 by Ion Gaztañaga, 8 years ago

In the soon to be released Boost 1.56 version if BOOST_INTERPROCESS_SHARED_DIR_PATH is defined, that directory is used to store data among processes. Do you think it could work in your case?

comment:2 by Ronny Bantin, 8 years ago

I have not reported this ticket. I can say this works on Android. But the /sdcard is mount to an flash device. So there is a significant latency and maybe you reduce the regular life time of the internal flash device.

Android does not support Posix SHM. Instead, it has its own shared memory implementation (/dev/ashmem). It would be very nice to porting boost::interprocess using Android shared memory like "windows_shared_memory.hpp".

comment:3 by anonymous, 5 years ago

I solved it by revision the file 'interprocess/detail/shared_dir_helpers.hpp' line 109 to change the dir_path to an existed dir (for me, it's /data) in get_shared_dir_root()

#elif defined ANDROID

dir_path="/data"

#else

dir_path="/tmp"

Note: See TracTickets for help on using tickets.