apr-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From <...@rkbloom.net>
Subject Re: apr_shm_attach() and APR_EEXIST
Date Wed, 26 May 2004 12:17:46 GMT

Linux supports both anonymous and named shared memory.  By default though,
Linux is using SHMGET in APR, which is named, but not backed by a file.
You will get APR_EEXIST if the semaphore already exists, this can be
checked by running ipcs.

I hit this problem with the test suite at one point, and spent days trying
to figure out why I was getting APR_EEXIST when the file didn't exist.  It
wasn't until I realized that I was dealing with semaphores that the light
dawned.  I'll devote some time to trying to figure out an error code
solution for this over the next few days.

Ryan

On Wed, 26 May 2004, Graham Leggett wrote:

> rbb@rkbloom.net wrote:
>
> > This is a deficiency in our error reporting for apr_shm_foo.  Basically,
> > we always use the same error codes, regardless of the shm mechanism used.
> > In all likelyhood, your problem is that your system is using shmget under
> > the covers.  In that case, we don't use the filename that you pass in.
> > So, run ipcs and see if the shared memory segment that you are trying to
> > create does already exist.  It would be great if we could fix this so that
> > users got a useful error message in this case.
>
> The mist clears.
>
> It seems Linux only supports anonymous shared memory, as if a filename
> is provided apr_shm_create() returns APR_EEXIST, and apr_shm_attach()
> returns APR_EGENERAL. Is this correct?
>
> Regards,
> Graham
> --
>


Mime
View raw message