Access mmap memory from another process
<p>I've started playing with mmap. I'm trying to create an example workspace that will be then extended to the real case.</p>

<p>This is what I want to achieve:</p>

<p>PROCESS 1:</p>

<ul>
<li>mmap a file (actually a device, but it's okay to generate an example with a text file)</li>
</ul>

<p>PROCESS 2: (not foked from process 1; just an independent process)</p>

<ul>
<li>read the memory mapped by process 1</li>
<li>change some bits</li>
<li>write it to a new file</li>
</ul>

<p>I've read several examples and documentations, but I still didn't find how to achieve this. What I'm missing is:</p>

<ul>
<li>how can process 2 access the memory mapped by process 1, without knowing anything about the opened file?</li>
<li>how can I put the mmap content in a new file? I suppose I have to ftruncate a new file, mmap this file and memcpy the content of process 1 memory map to process 2 memory map (then msync)</li>
</ul>

<p>Side info, I have a message queue opened between the two processes, so they can share some messages if needed (ex. the memory address/size, ...).</p>

<p>Any hints?</p>

<p>Thanks in advance!</p>

<p>MIX</p>