Thanks Sorin. The program worked fine when I made the changes you suggested(I had to change the last line to "++((int) *shm_base);"). Can I employ the same idea when it comes to more complicated structures? I will be making my own implementation of a linked list as a shared memory structure? Suppose, that the list is declared as "list *my_list", can I just call set_shared region like this: set_shared_region(&my_list) ? Would this work?
-----Original Message----- From: Sorin Manolache [mailto:sor...@gmail.com] Sent: Wednesday, November 16, 2011 5:51 PM To: modules-dev@httpd.apache.org Subject: Re: Apache shared memory implementation You have some problems with the pointers. You should have void *shm_base; and then set_shared_region(void **base) { ... *base = mmap(...); if (*base == MAP_FAILED) { ... } ... } set_shared_region(&shm_base); and when you increment the counter, you do ++((int *)shm_base); -- S
smime.p7s
Description: S/MIME cryptographic signature