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 28 29 30 31 32 33 34 35 36
|
/*
* Copyright (C) 1996-2025 The Squid Software Foundation and contributors
*
* Squid software is distributed under GPLv2+ license and includes
* contributions from numerous individuals and organizations.
* Please see the COPYING and CONTRIBUTORS files for details.
*/
#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)) || _SQUID_DRAGONFLY_
return true;
#elif _SQUID_FREEBSD_
int jailed = 0;
size_t len = sizeof(jailed);
::sysctlbyname("security.jail.jailed", &jailed, &len, nullptr, 0);
return !jailed;
#else
return false;
#endif
}
|