Joe Orton wrote:

  
I don't think it is possible. APR does not pass back any information
in case of error, other than error code itself. (and anyway XXX is shmid
returned by shmget() which is failing in your case)
    
I guess it could be made useful either by having apr_shm_create() remove
an existing shm segment with the given name then re-create it (as MM
does IIRC), 
MM takes care for this for mmap style shared-memory. Talking about shm_xxx
style shared-memory, AFAIU it simply keeps itself away from name-based shm.

or to add an apr_shm_remove() function which removes a
name-based shm segment as only APR knows how.
+1 on this idea.

It would be very useful for programmers. They could simply do one of the
following to avoid headaches of admins :)

- call apr_shm_remove right before apr_shm_create()
- detect unclean shutdown case and call apr_shm_remove()

I could prepare a patch for this if people are happy with this idea ;)