site_archiver@lists.apple.com Delivered-To: darwin-dev@lists.apple.com -- Terry _______________________________________________ Do not post admin requests to the list. They will be ignored. Darwin-dev mailing list (Darwin-dev@lists.apple.com) Help/Unsubscribe/Update your Subscription: http://lists.apple.com/mailman/options/darwin-dev/site_archiver%40lists.appl... On Sep 19, 2007, at 8:32 AM, Tom O'Grady wrote: [creating read only shared memory using same name]: CLockMutex mutexSection(mutex); // mutex created using posix semaphore. SharedMemID = shm_open(memname, O_RDONLY, 0x777); // Create shared memory with read access. struct stat fstats; fstat(SharedMemID, &fstats); // check to see if the memory has been allocated and initialised // In this case, the size is already set and the permissions are set to 0x777. Therefore no truncation is required - I just map the memory: smptr = mmap( 0, size, PROT_READ, MAP_SHARED, SharedMemID, 0 ); I suspect that in your real code you are specifying O_CREAT in the O_RDNOLY case, and that is causing the mode to get rest on the shared memory object. If you're not sure if the shared memory exists, you should specify O_EXCL on the create, which will prevent it from being created if it already exists. This email sent to site_archiver@lists.apple.com