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() spawned process?
UPDATE1:
Thanks for your inputs, I do use shared memory creating it with mmap with MAP_INHERIT flag:
Each mapped file and shared memory region created with the mmap() function is unmapped by a successful call to any of the exec functions, except those regions mapped with the MAP_INHERIT option. Regions mapped with the MAP_INHERIT option remain mapped in the new process image.
source: http://www.uwm.edu/cgi-bin/IMT/wwwman?topic=exec(2)&msection=
UPDATE2:
This is homework excercise, but I think I must stop thinking about pointers and think about the IPC itself. I guess I will go with trying to mmap the same file in child process.
Short code example much appreciated.
Thanks in advance for your help.