File: shm.cc

package info (click to toggle)
squid3 3.4.8-6
  • links: PTS
  • area: main
  • in suites: jessie-kfreebsd
  • size: 31,084 kB
  • sloc: cpp: 165,325; ansic: 21,998; sh: 12,166; makefile: 5,964; perl: 2,153; sql: 322; awk: 118
file content (27 lines) | stat: -rw-r--r-- 778 bytes parent folder | download | duplicates (3)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
#include "squid.h"
#include "compat/shm.h"

#if _SQUID_FREEBSD_ && (__FreeBSD__ >= 7)
#include <sys/sysctl.h>
#endif

/*
 * Some systems have filesystem-based resources and interpret segment names
 * as file paths. The so-called 'portable' "/name" format does not work well
 * for them. And, according to Boost::interprocess, recent FreeBSD versions
 * make this decision depending on whether the shm_open() caller is jailed!
 */
bool
shm_portable_segment_name_is_path()
{
#if _SQUID_HPUX_ || _SQUID_OSF_ || defined(__vms) || (_SQUID_FREEBSD_ && (__FreeBSD__ < 7))
    return true;
#elif _SQUID_FREEBSD_
    int jailed = 0;
    size_t len = sizeof(jailed);
    ::sysctlbyname("security.jail.jailed", &jailed, &len, NULL, 0);
    return !jailed;
#else
    return false;
#endif
}