On Tue, Jun 21, 2011 at 23:26, Jason Funk <jasonlf...@gmail.com> wrote: > One last question about shared memory... > > I have my configuration now being loaded successfully into a shared memory > segment.. now my problem is that someone could change the config so that the > resulting structure wouldn't fit in the shared memory segment. Is it > possible to in the child replace my current shared memory segment with a > bigger one? I tried destroy()ing and then create()ing but that resulted in a > segfault. Should it have worked? Is there a different way?
As I've said before, no, you cannot portably resize a shared memory segment. APR doesn't even expose that functionality. If you're targeting Unices only, you can use Sys V or POSIX IPC: you open() or shm_open() a memory segment, then ftruncate() it to the desired size. Make sure to wrap the call to ftruncate() in an exclusive lock or bad things will happen.