changing mmap() permissions
Kevin Buettner
plug-discuss@lists.plug.phoenix.az.us
Tue, 20 Aug 2002 12:10:26 -0700
On Aug 20, 11:44am, Randy Kaelber wrote:
> I'm trying to implement a distributed shared memory system using network
> sockets and mmap(). A problem I have run into is that I want to protect
> segments of memory from being written to by a process. While it's easy
> enough to mmap() a region read only, What I want to do is receive a
> chunk of data from a remote process, mmap() it to a specific address,
> and then make that block read-only, such that if a process tries to
> write it after I've copied it in, it will get a seg fault. If I start
> read only, I cannot copy data to the region at all.
Take a look at mprotect().
Kevin