Operating System - Linux
1755087 Members
4475 Online
108829 Solutions
New Discussion

Write Protect Shared Memory Section

 
Srinivasan S_1
Advisor

Write Protect Shared Memory Section

Hi,

I create shared memory with read and write.

But I want particular area of memory alone to be protected so that Others cannot overwrite that section.

I came across mmap / mprotect .
Can any one tell whether with mmap/ mprotect it can be achieve or any other solution ?

I want this code to be portable too!
1 REPLY 1
Dennis Handly
Acclaimed Contributor

Re: Write Protect Shared Memory Section

Yes, mprotect can protect whole pages. That's what's used for guard pages for thread stacks.

You probably got this info from Don in your other thread:
http://forums.itrc.hp.com/service/forums/questionanswer.do?threadId=580158