I'm searched the Web and this board, and I've read the man pages, and I've read two books that touch on this subject. I am getting a tad fustrated.
The man pages say it's best to pass in NULL for the second argument of shmat(), but if I do that, the pointer that's returned to me could be *anywhere* in the segment of shared memory. How could I find the beginning of the segment with only a pointer to some random spot in the middle?
Conversely, I could pass in the memory address to shmat() that was returned to me from the first time I attached shared memory. This had been working well for me for a while until I tried attaching to two seperate segments of shared memory that were created by two seperate processes. I received the EINVAL error. I don't understand what's invalid about what I'm trying to do. It used to work. Could it have something to do with the fact that both segments seem to have the same address? They have different IDs.
I feel like I'm missing something because every example I've looked at passes in NULL for the address.



LinkBack URL
About LinkBacks


