Quote:
Originally Posted by
mae4
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?