I would like to pass a pointer (I am putting a file with data in memory with mmap) to processes spawned using fork + exec, but I am stuck on how to pass a pointer to the exec()
The spawned process should probably open a pipe back to the parent process and ask for the data it needs to map the shared memory segment.
Alternatively you can use boost::interprocess to create a shared memory segment for you and actually pass around the address (it can do the mapping). You're on your own reading that documentation though: http://www.boost.org/doc/libs/1_38_0/doc/html/interprocess.html