• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
Re: Posix shared memory - permission problems?
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Posix shared memory - permission problems?


  • Subject: Re: Posix shared memory - permission problems?
  • From: Terry Lambert <email@hidden>
  • Date: Wed, 19 Sep 2007 15:46:44 -0700

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.


-- Terry
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Darwin-dev mailing list      (email@hidden)
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden


  • Follow-Ups:
    • Re: Posix shared memory - permission problems?
      • From: "Tom O'Grady" <email@hidden>
References: 
 >Posix shared memory - permission problems? (From: "Tom O'Grady" <email@hidden>)

  • Prev by Date: Re: Identifying directory changes with kqueue/kevent
  • Next by Date: Re: Posix shared memory - permission problems?
  • Previous by thread: Posix shared memory - permission problems?
  • Next by thread: Re: Posix shared memory - permission problems?
  • Index(es):
    • Date
    • Thread