On Friday, December 13, 2002, at 09:20 AM, Joe Orton wrote:
For the implementation of name-based apr_shm_create using shmget (i.e. the filename != NULL case), I've got two questions:
1) why is APR_EXCL passed to the apr_file_open call? This is annoying for Apache since if the server crashes, you have to remove the shmem segment *and* the filename before restarting. Patch below OK?
The existance of the file can only mean that the application doesn't know what state that shmem segment is in, and must deal with that before trying to recreate the segment. For example, if you accidently started Apache a second time, you wouldn't want it to trounce on the previous instance's shmem file.
If your application is sure that the segment is not in use, then remove the file.
2) why is the file used to store the segment size, rather than using the
shm_segsz member of the shmid_ds structure?
I assume you're talking about APR_USE_SHMEM_SHMGET and not SHMGET_ANON? I can't remember why I did that, but I think there was a reason. It might have had to do with page-alignment of the size, or the need for the actual requested size rather than the OS's returned size.
-aaron
