update boost on linux

This commit is contained in:
Bassem Girgis
2019-08-10 16:06:25 -05:00
parent 76ad52be58
commit 861b918727
5363 changed files with 483306 additions and 116507 deletions

View File

@@ -567,6 +567,60 @@ inline boost::uint32_t atomic_cas32
inline void atomic_write32(volatile boost::uint32_t *mem, boost::uint32_t val)
{ __sync_synchronize(); *mem = val; }
} //namespace ipcdetail{
} //namespace interprocess{
} //namespace boost{
#elif defined(__VXWORKS__)
#include <vxAtomicLib.h>
// VxWorks atomic32_t is not volatile, for some unknown reason
#define vx_atomic_cast(_i) (reinterpret_cast< ::atomic32_t *>( const_cast<boost::uint32_t *>(_i)))
namespace boost {
namespace interprocess {
namespace ipcdetail{
//! Atomically add 'val' to an boost::uint32_t
//! "mem": pointer to the object
//! "val": amount to add
//! Returns the old value pointed to by mem
inline boost::uint32_t atomic_add32
(volatile boost::uint32_t *mem, boost::uint32_t val)
{ return ::vxAtomic32Add( vx_atomic_cast(mem), val); }
//! Atomically increment an apr_uint32_t by 1
//! "mem": pointer to the object
//! Returns the old value pointed to by mem
inline boost::uint32_t atomic_inc32(volatile boost::uint32_t *mem)
{ return ::vxAtomic32Inc( vx_atomic_cast(mem) ); }
//! Atomically decrement an boost::uint32_t by 1
//! "mem": pointer to the atomic value
//! Returns the old value pointed to by mem
inline boost::uint32_t atomic_dec32(volatile boost::uint32_t *mem)
{ return ::vxAtomic32Dec( vx_atomic_cast(mem) ); }
//! Atomically read an boost::uint32_t from memory
inline boost::uint32_t atomic_read32(volatile boost::uint32_t *mem)
{ return ::vxAtomic32Get( vx_atomic_cast(mem) ); }
//! Compare an boost::uint32_t's value with "cmp".
//! If they are the same swap the value with "with"
//! "mem": pointer to the value
//! "with" what to swap it with
//! "cmp": the value to compare it to
//! Returns the old value of *mem
inline boost::uint32_t atomic_cas32
(volatile boost::uint32_t *mem, boost::uint32_t with, boost::uint32_t cmp)
{ return ::vxAtomic32Cas( vx_atomic_cast(mem), cmp, with); }
//! Atomically set an boost::uint32_t in memory
//! "mem": pointer to the object
//! "param": val value that the object will assume
inline void atomic_write32(volatile boost::uint32_t *mem, boost::uint32_t val)
{ ::vxAtomic32Set( vx_atomic_cast(mem), val); }
} //namespace ipcdetail{
} //namespace interprocess{
} //namespace boost{

View File

@@ -113,12 +113,13 @@ class file_wrapper
bool priv_open_or_create(ipcdetail::create_enum_t type, const char *filename, mode_t mode, const permissions &perm);
file_handle_t m_handle;
mode_t m_mode;
std::string m_filename;
mode_t m_mode;
std::string m_filename;
};
inline file_wrapper::file_wrapper()
: m_handle(file_handle_t(ipcdetail::invalid_file()))
: m_handle(file_handle_t(ipcdetail::invalid_file()))
, m_mode(read_only), m_filename()
{}
inline file_wrapper::~file_wrapper()

View File

@@ -51,7 +51,7 @@ template<class T>
struct placement_destroy : public in_place_interface
{
placement_destroy()
: in_place_interface(::boost::container::container_detail::alignment_of<T>::value, sizeof(T), typeid(T).name())
: in_place_interface(::boost::container::dtl::alignment_of<T>::value, sizeof(T), typeid(T).name())
{}
virtual void destroy_n(void *mem, std::size_t num, std::size_t &destroyed)

View File

@@ -290,7 +290,7 @@ class intermodule_singleton_common
static union mem_holder_t
{
unsigned char map_mem [sizeof(ThreadSafeGlobalMap)];
::boost::container::container_detail::max_align_t aligner;
::boost::container::dtl::max_align_t aligner;
} mem_holder;
};

View File

@@ -115,8 +115,8 @@ class managed_open_or_create_impl
ct_rounded_size
< sizeof(boost::uint32_t)
, MemAlignment ? (MemAlignment) :
(::boost::container::container_detail::alignment_of
< ::boost::container::container_detail::max_align_t >::value)
(::boost::container::dtl::alignment_of
< ::boost::container::dtl::max_align_t >::value)
>::value;
managed_open_or_create_impl()

View File

@@ -274,7 +274,7 @@ class named_proxy
T *operator()( BOOST_MOVE_UREF##N ) const\
{\
typedef typename if_c<is_iterator \
, CtorIt##N<T BOOST_MOVE_I##N BOOST_MOVE_TARG##N> \
, CtorIt##N <T BOOST_MOVE_I##N BOOST_MOVE_TARG##N> \
, CtorArg##N<T BOOST_MOVE_I##N BOOST_MOVE_TARG##N> \
>::type ctor_obj_t;\
ctor_obj_t ctor_obj = ctor_obj_t( BOOST_MOVE_FWD##N );\

View File

@@ -52,6 +52,9 @@
# include <sys/param.h>
# include <sys/sysctl.h>
# endif
#if defined(__VXWORKS__)
#include <vxCpuLib.h>
#endif
//According to the article "C/C++ tip: How to measure elapsed real time for benchmarking"
//Check MacOs first as macOS 10.12 SDK defines both CLOCK_MONOTONIC and
//CLOCK_MONOTONIC_RAW and no clock_gettime.
@@ -480,6 +483,18 @@ inline unsigned int get_num_cores()
else{
return static_cast<unsigned int>(num_cores);
}
#elif defined(__VXWORKS__)
cpuset_t set = ::vxCpuEnabledGet();
#ifdef __DCC__
int i;
for( i = 0; set; ++i)
{
set &= set -1;
}
return(i);
#else
return (__builtin_popcount(set) );
#endif
#endif
}

View File

@@ -117,7 +117,7 @@ struct block_header
{
return get_rounded_size
( size_type(sizeof(Header))
, size_type(::boost::container::container_detail::alignment_of<block_header<size_type> >::value))
, size_type(::boost::container::dtl::alignment_of<block_header<size_type> >::value))
+ total_size();
}
@@ -169,7 +169,7 @@ struct block_header
template<class T>
static block_header<size_type> *block_header_from_value(T *value)
{ return block_header_from_value(value, sizeof(T), ::boost::container::container_detail::alignment_of<T>::value); }
{ return block_header_from_value(value, sizeof(T), ::boost::container::dtl::alignment_of<T>::value); }
static block_header<size_type> *block_header_from_value(const void *value, std::size_t sz, std::size_t algn)
{
@@ -190,7 +190,7 @@ struct block_header
block_header<size_type> * hdr =
reinterpret_cast<block_header<size_type>*>(reinterpret_cast<char*>(header) +
get_rounded_size( size_type(sizeof(Header))
, size_type(::boost::container::container_detail::alignment_of<block_header<size_type> >::value)));
, size_type(::boost::container::dtl::alignment_of<block_header<size_type> >::value)));
//Some sanity checks
return hdr;
}
@@ -201,7 +201,7 @@ struct block_header
Header * hdr =
reinterpret_cast<Header*>(reinterpret_cast<char*>(bheader) -
get_rounded_size( size_type(sizeof(Header))
, size_type(::boost::container::container_detail::alignment_of<block_header<size_type> >::value)));
, size_type(::boost::container::dtl::alignment_of<block_header<size_type> >::value)));
//Some sanity checks
return hdr;
}
@@ -275,7 +275,7 @@ struct intrusive_value_type_impl
intrusive_value_type_impl(){}
enum { BlockHdrAlignment = ::boost::container::container_detail::alignment_of<block_header<size_type> >::value };
enum { BlockHdrAlignment = ::boost::container::dtl::alignment_of<block_header<size_type> >::value };
block_header<size_type> *get_block_header() const
{

View File

@@ -27,170 +27,14 @@
// interprocess
#include <boost/interprocess/interprocess_fwd.hpp>
// interprocess/detail
#include <boost/interprocess/detail/type_traits.hpp>
// move/detail
#include <boost/container/detail/iterator.hpp>
// container/detail
#include <boost/container/detail/transform_iterator.hpp>
namespace boost {
namespace interprocess {
template <class PseudoReference>
struct operator_arrow_proxy
{
operator_arrow_proxy(const PseudoReference &px)
: m_value(px)
{}
PseudoReference* operator->() const { return &m_value; }
// This function is needed for MWCW and BCC, which won't call operator->
// again automatically per 13.3.1.2 para 8
// operator T*() const { return &m_value; }
mutable PseudoReference m_value;
};
template <class T>
struct operator_arrow_proxy<T&>
{
operator_arrow_proxy(T &px)
: m_value(px)
{}
T* operator->() const { return const_cast<T*>(&m_value); }
// This function is needed for MWCW and BCC, which won't call operator->
// again automatically per 13.3.1.2 para 8
// operator T*() const { return &m_value; }
T &m_value;
};
template <class Iterator, class UnaryFunction>
class transform_iterator
: public UnaryFunction
{
public:
typedef typename ::boost::container::iterator_traits<Iterator>::iterator_category iterator_category;
typedef typename ipcdetail::remove_reference<typename UnaryFunction::result_type>::type value_type;
typedef typename ::boost::container::iterator_traits<Iterator>::difference_type difference_type;
typedef operator_arrow_proxy<typename UnaryFunction::result_type> pointer;
typedef typename UnaryFunction::result_type reference;
explicit transform_iterator(const Iterator &it, const UnaryFunction &f = UnaryFunction())
: UnaryFunction(f), m_it(it)
{}
explicit transform_iterator()
: UnaryFunction(), m_it()
{}
//Constructors
transform_iterator& operator++()
{ increment(); return *this; }
transform_iterator operator++(int)
{
transform_iterator result (*this);
increment();
return result;
}
transform_iterator& operator--()
{ decrement(); return *this; }
transform_iterator operator--(int)
{
transform_iterator result (*this);
decrement();
return result;
}
friend bool operator== (const transform_iterator& i, const transform_iterator& i2)
{ return i.equal(i2); }
friend bool operator!= (const transform_iterator& i, const transform_iterator& i2)
{ return !(i == i2); }
friend bool operator< (const transform_iterator& i, const transform_iterator& i2)
{ return i < i2; }
friend bool operator> (const transform_iterator& i, const transform_iterator& i2)
{ return i2 < i; }
friend bool operator<= (const transform_iterator& i, const transform_iterator& i2)
{ return !(i > i2); }
friend bool operator>= (const transform_iterator& i, const transform_iterator& i2)
{ return !(i < i2); }
friend difference_type operator- (const transform_iterator& i, const transform_iterator& i2)
{ return i2.distance_to(i); }
//Arithmetic
transform_iterator& operator+=(difference_type off)
{ this->advance(off); return *this; }
transform_iterator operator+(difference_type off) const
{
transform_iterator other(*this);
other.advance(off);
return other;
}
friend transform_iterator operator+(difference_type off, const transform_iterator& right)
{ return right + off; }
transform_iterator& operator-=(difference_type off)
{ this->advance(-off); return *this; }
transform_iterator operator-(difference_type off) const
{ return *this + (-off); }
typename UnaryFunction::result_type operator*() const
{ return dereference(); }
typename UnaryFunction::result_type operator[](difference_type off) const
{ return UnaryFunction::operator()(m_it[off]); }
operator_arrow_proxy<typename UnaryFunction::result_type>
operator->() const
{ return operator_arrow_proxy<typename UnaryFunction::result_type>(dereference()); }
Iterator & base()
{ return m_it; }
const Iterator & base() const
{ return m_it; }
private:
Iterator m_it;
void increment()
{ ++m_it; }
void decrement()
{ --m_it; }
bool equal(const transform_iterator &other) const
{ return m_it == other.m_it; }
bool less(const transform_iterator &other) const
{ return other.m_it < m_it; }
typename UnaryFunction::result_type dereference() const
{ return UnaryFunction::operator()(*m_it); }
void advance(difference_type n)
{ ::boost::container::iterator_advance(m_it, n); }
difference_type distance_to(const transform_iterator &other)const
{ return ::boost::container::iterator_distance(other.m_it, m_it); }
};
template <class Iterator, class UnaryFunc>
transform_iterator<Iterator, UnaryFunc>
make_transform_iterator(Iterator it, UnaryFunc fun)
{
return transform_iterator<Iterator, UnaryFunc>(it, fun);
}
using boost::container::make_transform_iterator;
using boost::container::transform_iterator;
} //namespace interprocess {
} //namespace boost {

View File

@@ -25,10 +25,10 @@ namespace boost {
namespace interprocess {
namespace ipcdetail {
using boost::container::container_detail::tuple;
using boost::container::container_detail::build_number_seq;
using boost::container::container_detail::index_tuple;
using boost::container::container_detail::get;
using boost::container::dtl::tuple;
using boost::container::dtl::build_number_seq;
using boost::container::dtl::index_tuple;
using boost::container::dtl::get;
}}} //namespace boost { namespace interprocess { namespace ipcdetail {

View File

@@ -99,18 +99,24 @@
//
//////////////////////////////////////////////////////////////////////////////
//Ignore -pedantic errors here (anonymous structs, etc.)
#if defined(BOOST_GCC)
//Ignore -pedantic errors here (anonymous structs, etc.)
# if (BOOST_GCC >= 40600)
# pragma GCC diagnostic push
# if (BOOST_GCC >= 60000)
# if (BOOST_GCC >= 40800)
# pragma GCC diagnostic ignored "-Wpedantic"
# else
# pragma GCC diagnostic ignored "-pedantic"
# endif
# pragma GCC diagnostic ignored "-Wnon-virtual-dtor"
# else
# pragma GCC system_header
# endif
//When loading DLLs we have no option but reinterpret casting function types
# if (BOOST_GCC >= 80000)
# pragma GCC diagnostic ignored "-Wcast-function-type"
# endif
#endif
namespace boost {
@@ -1535,7 +1541,6 @@ struct function_address_holder
, NtOpenFile
, NtClose
, NtQueryTimerResolution
, NtSetTimerResolution
, QueryPerformanceCounter
, QueryPerformanceFrequency
, NumFunction
@@ -1618,7 +1623,6 @@ const char *function_address_holder<Dummy>::FunctionNames[function_address_holde
"NtOpenFile",
"NtClose",
"NtQueryTimerResolution",
"NtSetTimerResolution",
"QueryPerformanceCounter",
"QueryPerformanceFrequency"
};
@@ -1634,7 +1638,6 @@ unsigned int function_address_holder<Dummy>::FunctionModules[function_address_ho
NtDll_dll,
NtDll_dll,
NtDll_dll,
NtDll_dll,
Kernel32_dll,
Kernel32_dll
};
@@ -1675,8 +1678,8 @@ struct library_unloader
inline bool get_system_time_of_day_information(system_timeofday_information &info)
{
NtQuerySystemInformation_t pNtQuerySystemInformation = (NtQuerySystemInformation_t)
dll_func::get(dll_func::NtQuerySystemInformation);
NtQuerySystemInformation_t pNtQuerySystemInformation = reinterpret_cast<NtQuerySystemInformation_t>
(dll_func::get(dll_func::NtQuerySystemInformation));
unsigned long res;
long status = pNtQuerySystemInformation(system_time_of_day_information, &info, sizeof(info), &res);
if(status){
@@ -1892,9 +1895,9 @@ inline bool unlink_file(const char *filename)
// file name can't be used to open this file again
try{
NtSetInformationFile_t pNtSetInformationFile =
(NtSetInformationFile_t)dll_func::get(dll_func::NtSetInformationFile);
reinterpret_cast<NtSetInformationFile_t>(dll_func::get(dll_func::NtSetInformationFile));
NtQueryObject_t pNtQueryObject = (NtQueryObject_t)dll_func::get(dll_func::NtQueryObject);
NtQueryObject_t pNtQueryObject = reinterpret_cast<NtQueryObject_t>(dll_func::get(dll_func::NtQueryObject));
//First step: Obtain a handle to the file using Win32 rules. This resolves relative paths
void *fh = create_file(filename, generic_read | delete_access, open_existing, 0, 0);
@@ -1966,8 +1969,8 @@ inline bool unlink_file(const char *filename)
{
//Don't use pNtSetInformationFile with file_disposition_information as it can return STATUS_CANNOT_DELETE
//if the file is still mapped. Reopen it with NtOpenFile and file_delete_on_close
NtOpenFile_t pNtOpenFile = (NtOpenFile_t)dll_func::get(dll_func::NtOpenFile);
NtClose_t pNtClose = (NtClose_t)dll_func::get(dll_func::NtClose);
NtOpenFile_t pNtOpenFile = reinterpret_cast<NtOpenFile_t>(dll_func::get(dll_func::NtOpenFile));
NtClose_t pNtClose = reinterpret_cast<NtClose_t>(dll_func::get(dll_func::NtClose));
const wchar_t empty_str [] = L"";
unicode_string_t ustring = { sizeof(empty_str) - sizeof (wchar_t) //length in bytes without null
, sizeof(empty_str) //total size in bytes of memory allocated for Buffer.
@@ -2035,7 +2038,7 @@ inline bool get_registry_value_string(hkey key_type, const char *subkey_name, co
unsigned long size;
unsigned long type;
long err = reg_query_value_ex( key, value_name, 0, &type, 0, &size);
if((reg_sz == type || reg_expand_sz != type) && !err){
if((reg_sz == type || reg_expand_sz == type) && !err){
//Size includes terminating NULL
s.resize(size);
err = reg_query_value_ex( key, value_name, 0, &type, (unsigned char*)(&s[0]), &size);
@@ -2413,7 +2416,7 @@ inline bool is_directory(const char *path)
inline bool get_file_mapping_size(void *file_mapping_hnd, __int64 &size)
{
NtQuerySection_t pNtQuerySection =
(NtQuerySection_t)dll_func::get(dll_func::NtQuerySection);
reinterpret_cast<NtQuerySection_t>(dll_func::get(dll_func::NtQuerySection));
//Obtain file name
interprocess_section_basic_information info;
unsigned long ntstatus =
@@ -2426,7 +2429,7 @@ inline bool get_semaphore_info(void *handle, long &count, long &limit)
{
winapi::interprocess_semaphore_basic_information info;
winapi::NtQuerySemaphore_t pNtQuerySemaphore =
(winapi::NtQuerySemaphore_t)dll_func::get(winapi::dll_func::NtQuerySemaphore);
reinterpret_cast<winapi::NtQuerySemaphore_t>(dll_func::get(winapi::dll_func::NtQuerySemaphore));
unsigned int ret_len;
long status = pNtQuerySemaphore(handle, winapi::semaphore_basic_information, &info, sizeof(info), &ret_len);
count = info.count;
@@ -2437,28 +2440,21 @@ inline bool get_semaphore_info(void *handle, long &count, long &limit)
inline bool query_timer_resolution(unsigned long *lowres, unsigned long *highres, unsigned long *curres)
{
winapi::NtQueryTimerResolution_t pNtQueryTimerResolution =
(winapi::NtQueryTimerResolution_t)dll_func::get(winapi::dll_func::NtQueryTimerResolution);
reinterpret_cast<winapi::NtQueryTimerResolution_t>(dll_func::get(winapi::dll_func::NtQueryTimerResolution));
return !pNtQueryTimerResolution(lowres, highres, curres);
}
inline bool set_timer_resolution(unsigned long RequestedResolution, int Set, unsigned long* ActualResolution)
{
winapi::NtSetTimerResolution_t pNtSetTimerResolution =
(winapi::NtSetTimerResolution_t)dll_func::get(winapi::dll_func::NtSetTimerResolution);
return !pNtSetTimerResolution(RequestedResolution, Set, ActualResolution);
}
inline bool query_performance_counter(__int64 *lpPerformanceCount)
{
QueryPerformanceCounter_t pQueryPerformanceCounter = (QueryPerformanceCounter_t)
dll_func::get(dll_func::QueryPerformanceCounter);
QueryPerformanceCounter_t pQueryPerformanceCounter = reinterpret_cast<QueryPerformanceCounter_t>
(dll_func::get(dll_func::QueryPerformanceCounter));
return 0 != pQueryPerformanceCounter(lpPerformanceCount);
}
inline bool query_performance_frequency(__int64 *lpFrequency)
{
QueryPerformanceCounter_t pQueryPerformanceFrequency = (QueryPerformanceFrequency_t)
dll_func::get(dll_func::QueryPerformanceFrequency);
QueryPerformanceCounter_t pQueryPerformanceFrequency = reinterpret_cast<QueryPerformanceFrequency_t>
(dll_func::get(dll_func::QueryPerformanceFrequency));
return 0 != pQueryPerformanceFrequency(lpFrequency);
}

View File

@@ -31,7 +31,7 @@
//////////////////////////////////////////////////////
//Check for XSI shared memory objects. They are available in nearly all UNIX platforms
//////////////////////////////////////////////////////
#if !defined(__QNXNTO__) && !defined(__ANDROID__) && !defined(__HAIKU__)
#if !defined(__QNXNTO__) && !defined(__ANDROID__) && !defined(__HAIKU__) && !(__VXWORKS__)
#define BOOST_INTERPROCESS_XSI_SHARED_MEMORY_OBJECTS
#endif
@@ -49,17 +49,12 @@
//Cygwin defines _POSIX_THREAD_PROCESS_SHARED but does not implement it.
#if defined(__CYGWIN__)
#define BOOST_INTERPROCESS_BUGGY_POSIX_PROCESS_SHARED
//Mac Os X < Lion (10.7) might define _POSIX_THREAD_PROCESS_SHARED but there is no real support.
#elif defined(__APPLE__)
#include "TargetConditionals.h"
//Check we're on Mac OS target
#if defined(TARGET_OS_MAC)
#include "AvailabilityMacros.h"
//If minimum target for this compilation is older than Mac Os Lion, then we are out of luck
#if MAC_OS_X_VERSION_MIN_REQUIRED < 1070
#define BOOST_INTERPROCESS_BUGGY_POSIX_PROCESS_SHARED
#endif
#endif
//The pthreads implementation of darwin stores a pointer to a mutex inside the condition
//structure so real sharing between processes is broken. See:
//https://opensource.apple.com/source/libpthread/libpthread-301.30.1/src/pthread_cond.c.auto.html
//in method pthread_cond_wait
#define BOOST_INTERPROCESS_BUGGY_POSIX_PROCESS_SHARED
#endif
//If buggy _POSIX_THREAD_PROCESS_SHARED is detected avoid using it