According to the man (, ftok() uses only the low-order 8-bits of the id.
Maybe the APR could use the last char of the filename instead, so that the users knows and can choose it.
For APR's internal/choosen filenames (if any), this byte could be generated randomly.

On Fri, Jan 24, 2014 at 10:57 PM, Jim Jagielski <> wrote:
On httpd there was a discussion regarding versioning, and
this got me thinking...

Included in the APR 1.5.1 changes is an internal change
to how apr_shm_create(), when using APR_USE_SHMEM_SHMGET,
calculates the key (via ftok())...

The problem (see the Bugz report) was that using the constant
1 would cause collisions, so I adjusted it to use a hash
of the filename. The problem there is that any external
APR users that needed to also determine the key needs to
be aware of that. And from what I can see, there is no
easy way to do that.

So I will be pulling that from 2.0-dev and 1.5-dev until
we can figure out a better way. Ideas appreciated.