I started playing with mmap. I am trying to create an approximate workspace that will then be extended to a real case.
This is what I want to achieve:
PROCESS 1:
- mmap file (this is actually a device, but it’s ok to generate an example with a text file)
PROCESS 2: (not torn from process 1, but only an independent process)
- read memory displayed by process 1
- change some bits
- write it to a new file
I read a few examples and documents, but I still have not found how to do this. I am missing:
- how to handle 2 access to the memory displayed by process 1 without knowing anything about the file that opened?
- How can I put the contents of mmap in a new file? I assume that I need ftruncate a new file, mmap this file and memcpy the contents of the process 1 memory card to process 2 memory cards (then msync)
Lateral information. I have a message queue open between two processes, so they can share some messages (e.g. address / memory size, ...).
Any clues?
Thanks in advance!
Mix
source
share