This thread has been locked.

If you have a related question, please click the "Ask a related question" button in the top right corner. The newly created question will be automatically linked to this question.

Shared Memory across processes

I have a problem where I would like to share the same buffer in the sharedRegion between two processes.  If found the following post which verifies I can access the sharedRegion between processes (http://e2e.ti.com/support/embedded/linux/f/354/t/204547.aspx).  However how can I share a buffer between the processes and know the address of that buffer if I allocate with Memory_alloc?  Mermory_alloc appears to return a virtual address in my process so sharing this address across processes will not work.  I attempted mapping the virtual address to a physically address using the cmem api's (CMEM_getPhys) which uses the cmemk kernel module to do the mapping.  After I pass the physical address to my second process and using mmap with /dev/mem tried to map the memory.  As mmap requires memory to be page aligned.  Seems Memory_alloc has no regard for the 4kb page alignment I need.  So the physical address I get back needs to be page aligned.  The problem I see is changing this address changes the buffer mapping on the second process.  

I also tried using cmemk and specifying the start and end phy address to the shared region to access the memory in the second processes, I used /dev/cmem instead of /dev/mem.  Still no joy. (I also tried page aligning the phy address returned by CMEM_getphy, which did not work for mmap)  I'm wondering if there is a better way to share this buffer between processes?  Is there an API or parameter  for Memory_alloc to page align? (I tried the align parameter which appears to have no affect). 

Thanks,

Craig