Originally posted by: jpiaget
I am using mmap() to set up shared memory for an application which forks multiple processes. After these processes exit, I would like to set the shared memory regions which have been used to non-shared.
The initial mmap
int fd = open("/dev/zero", O_RDWR)
origMem = (void **)mmap(0,0x80000000,PROT_READ|PROT_WRITE,MAP_SHARED, fd, 0);
... later
newMem = (void **)mmap(origMem, 0x80000000,PROT_READ|PROT_WRITE,MAP_FIXED|MAP_PRIVATE,fd,0)
// newMem should be == origMem
The second mmap fails, although I think this should be OK based on the documentation I have seen.
Thanks
#AIX-Forum