The UNIX and Linux Forums  
Hello and Welcome from United States to the UNIX and Linux Forums! Thank You for Visiting and Joining Our Global Community.

Go Back   The UNIX and Linux Forums > Top Forums > High Level Programming
.
google unix.com




View Single Post in the UNIX and Linux Forums - Click on the Thread or Permalink to View Entire Thread -->
  #3 (permalink)  
Old 11-20-2008
Corona688 Corona688 is offline
Registered User
  
 

Join Date: Aug 2005
Location: Saskatchewan
Posts: 1,909
Quote:
Originally Posted by mae4 View Post
I have created a shared memory segment (which size is 64 bytes) using shmget, shmat e.t.c and i want to divide it into 2 areas. One area for input data and one area for output? How can i do that?
I'm guessing the purpose of that is to make half of it read-only. If so, you should just make two segments, I don't think you can make half of a segment read-only and certainly not in tiny 32-byte chunks. The OS can only actually map and protect memory in chunks of size pagesize(), which is often 4 kilobytes or more. See mmap() and mprotect() for details on what it's doing.

If that's not what you mean then I don't understand your question. Why not just use the upper and lower halves as is?