[boost::interprocess] between Rosetta and native apps - please advice how to fix issue
We need named IPC between Rosetta and native apps. In boost this seems not compatible, for example with Native app and we are unable to find the "MAP_FNAME" in find_and_construct on the Rosetta process. Works fine when each process is on same arch. " typedef boost::interprocess::managed_shared_memory shared_mem;shared_mem* seg;seg = new shared_mem(boost::interprocess::open_or_create, SHARED_FILENAME, F_MAX_TOTALBUF_SIZE );Img = seg->find_or_construct<imgtype>(MAP_FNAME)(); " Root cause seems to be MemoryAlgorithm and alignment.This has alignment of 16 for Rosetta and 8 for native.The 8 byte shift seems to be the root cause and I can see this when viewing memory. Looking deeper over the last few days we can see this from the difference in frontend size (from MemoryAlgorithm): "boost::interprocess::open_or_create This creates different sized frontend (iset_index 8 or 16)for Native vs Rosetta. frontend is defined from: boost::interprocess::ipcdetail::basic_managed_memory_impl<char, boost::interprocess::rbtree_best_fit<boost::interprocess::mutex_family>, boost::interprocess::iset_index, 16> *const Then perform segment->find_or_construct<mtstruct>(MAP_FNAME)(); does not work across arch." Ideally we prefer not to write a bunch of complex custom allocators etc to get this to work with open_or_create and find_or_construct, and hoping there is some simplest solution. Questions: how can we workaround this? Can we force boost::interprocess::open_or_create to use same memory algo for both arch? Or force alignment to 16 for both arch?
participants (1)
-
Frank G