]> git.ipfire.org Git - thirdparty/squid.git/blame - compat/shm.cc
Remove fake segments from the global Segments array when "unlinking" them.
[thirdparty/squid.git] / compat / shm.cc
CommitLineData
ef8de464
AR
1#include "config.h"
2#include "compat/shm.h"
3
4#if defined(__FreeBSD__) && (__FreeBSD__ >= 7)
5# include <sys/sysctl.h>
6#endif
7
8
9/*
10 * Some systems have filesystem-based resources and interpret segment names
11 * as file paths. The so-called 'portable' "/name" format does not work well
12 * for them. And, according to Boost::interprocess, recent FreeBSD versions
13 * make this decision depending on whether the shm_open() caller is jailed!
14 */
15bool
16shm_portable_segment_name_is_path()
17{
18#if defined(_SQUID_HPUX_) || defined(_SQUID_OSF_) || defined(__vms) || (defined(_SQUID_FREEBSD_) && (__FreeBSD__ < 7))
19 return true;
20#elif defined(_SQUID_FREEBSD_)
21 int jailed = 0;
22 size_t len = sizeof(jailed);
23 ::sysctlbyname("security.jail.jailed", &jailed, &len, NULL, 0);
24 return !jailed;
25#else
26 return false;
27#endif
28}