mmap(), MAP_SHARED, MAP_ANONYMOUS and sharing memory



Hi,

I have checked various unix specs and I am puzzled about how to share
memory between two processes using mmap().

AFAIK MAP_ANONYMOUS + MAP_PRIVATE would map /dev/zero (in linux man
pages don't mention /dev/zero) so the process can get some private
zero-initialised free memory, correct?

Then what would MAP_ANONYMOUS + MAP_SHARED do? If Linux specifies no
particular file for MAP_ANONYMOUS where would the shared mapping be
found by another process? Perhaps these two flags don't get used
together?

Thanks,
Bahadir
.



Relevant Pages