]> git.ipfire.org Git - thirdparty/squid.git/commit - src/ipc/mem/Segment.cc
Name shared memory segments in a more portable way
authorAlex Rousskov <rousskov@measurement-factory.com>
Wed, 26 Oct 2011 16:33:46 +0000 (10:33 -0600)
committerAlex Rousskov <rousskov@measurement-factory.com>
Wed, 26 Oct 2011 16:33:46 +0000 (10:33 -0600)
commitef8de4644e03ec6b88f83a8c44f311793e63e7ab
tree952f3429b01c2b6bb31405117330b24d510f3532
parent7b81a8f7d5915a61d2a5105e018717bac9f35505
Name shared memory segments in a more portable way
to make shm_open() work on FreeBSD and some other OSes.

Linux and friends use "/slashless-name" template for shared memory segment IDs.
HPUX and friends use "/full/path/to/some/file".
FreeBSD uses the former or the latter, depending on version and jail context.

We now distinguish the above cases and prefix the internal segment ID
accordingly. The above analysis and its implementation are based on the
boost::interprocess code.

To make matters worse, the right prefix for path-based OSes depends on whether
we are running an [installed] Squid binary or just a "make check" test case.
For test cases, we cannot use PREFIX-based paths because they may not exist.
Instead, we use the current directory. This is consistent with TESTDIR (i.e.,
cache_dir location) which each fs test case defines to be in the current
directory.

Finally, the segment name may clash with cache_dir name on path-based OSes. We
now append ".shm" to the segment name to reduce the likelihood of a collision.
TODO: Should StoreMap/etc (or their creators) append "map"/etc to their IDs?
CREDITS
compat/Makefile.am
compat/shm.cc [new file with mode: 0644]
compat/shm.h
src/ipc/mem/Segment.cc
src/ipc/mem/Segment.h
src/tests/testRock.cc