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 10:41:03 GMT

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.


On Wed, 26 May 2004, Graham Leggett wrote:

> Hi all,
> I am currently trying to figure out how this piece of code is going pear
> shaped:
>      result = apr_shm_create(&st->cache_shm, st->cache_bytes,
> st->cache_file, st->pool);
>      if (result == APR_EEXIST) {
>          result = apr_shm_attach(&st->cache_shm, st->cache_file, st->pool);
>      }
>      if (result != APR_SUCCESS) {
>          return result;
>      }
> When this code is run, apr_shm_create() returns APR_EEXIST, even when
> the file does not exist.
> Then, apr_shm_attach() returns 70014, which seems to correspond to
> APR_EGENERAL. The apr docs don't mention return codes, so I have no idea
> if this is normal or not.
> At the end of this, the shared memory segment file appears to be
> created, but with a length of zero.
> Can anyone explain how I can get an APR_SUCCESS out of the above? I am
> stumped.
> Regards,
> Graham
> --

View raw message