Skip to contentSkip to conversation

shmat problem

DISCUSSION Dirk Bull 2 participants 2 messages Jan 7, 2003

lore
Share & tools
lore

Dirk Bull

author
#0 lore raw

Thanks for your help. I also thought the memory mapping code I'm
porting looked funny. The code forms part of a simulation program where a few processes have to share data in a data base. In the code they(the original implementers) initialize a bunch of variables and then share these variables as I've shown you. I've referenced W.R Stevens's UNIX programming books and found no information on whether you could share memory other than that on the heap (did not want to change their code to use pointers, not a good idea to change too much of the original code). To end a long story, Alex, thanks for the SHM_REMAP flag, would never have found it, you've saved me a lot of time. Finally, in the code they share pages, therefor using SHM_REMAP is not that unsafe, but still not good practice?

Thanks again.

Dirk

_________________________________________________________________
Help STOP SPAM: Try the new MSN 8 and get 2 months FREE* http://join.msn.com/?page=features/junkmail

#1 lore raw

Dirk Bull, Tue, Jan 07, 2003 09:14:17 +0100:

Quoted 2 lines

saved me a lot of time. Finally, in the code they share pages, therefor using SHM_REMAP is not that unsafe, but still not good practice?

it seems correctly implemented, but the approach is error-prone (Doug McNaught pointed on that).
What would you do if pagesize change? Fixing the code again maybe a painful way, if the remapping was made to a common practice.

-alex