I think only children can get it. To test this I wrote the test program
which is appended to the end of this email.
When I run it under Digital Unix I get:
ptr contains the string ""
Which indicates that other processes can not get to your anonymous
shared memory.
#include <stdlib.h>
#include <stdio.h>
#include <sys/mman.h>
int main(void)
{
int perms = PROT_READ|PROT_WRITE;
int flags = MAP_SHARED | MAP_ANONYMOUS;
int fd[2];
void *ptr;
char emp[8];
pipe(fd);
if(fork()) {
close(fd[0]);
ptr = mmap(0, 8192, perms, flags, -1, 0);
strcpy(ptr, "I am shared");
close(fd[1]);
} else {
close(fd[1]);
ptr = mmap(0, 8192, perms, flags, -1, 0);
read(fd[0], emp, sizeof(emp));
printf("ptr contains the string \"%s\" \n", ptr);
}
return 0;
}
-- ---------------------------------------------------------------------------- Jim Nance Avant! Corporation (919) 941-6655 Do you have sweet iced tea? jim_nance@avanticorp.com No, but theres sugar on the table.