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