annotate DEPENDENCIES/generic/include/boost/interprocess/detail/workaround.hpp @ 16:2665513ce2d3

Add boost headers
author Chris Cannam
date Tue, 05 Aug 2014 11:11:38 +0100
parents
children c530137014c0
rev   line source
Chris@16 1 //////////////////////////////////////////////////////////////////////////////
Chris@16 2 //
Chris@16 3 // (C) Copyright Ion Gaztanaga 2005-2012. Distributed under the Boost
Chris@16 4 // Software License, Version 1.0. (See accompanying file
Chris@16 5 // LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
Chris@16 6 //
Chris@16 7 // See http://www.boost.org/libs/interprocess for documentation.
Chris@16 8 //
Chris@16 9 //////////////////////////////////////////////////////////////////////////////
Chris@16 10
Chris@16 11 #ifndef BOOST_INTERPROCESS_DETAIL_WORKAROUND_HPP
Chris@16 12 #define BOOST_INTERPROCESS_DETAIL_WORKAROUND_HPP
Chris@16 13
Chris@16 14 #include <boost/interprocess/detail/config_begin.hpp>
Chris@16 15
Chris@16 16 #if defined(_WIN32) || defined(__WIN32__) || defined(WIN32)
Chris@16 17 #define BOOST_INTERPROCESS_WINDOWS
Chris@16 18 #define BOOST_INTERPROCESS_FORCE_GENERIC_EMULATION
Chris@16 19 #define BOOST_INTERPROCESS_HAS_KERNEL_BOOTTIME
Chris@16 20 //Define this to connect with shared memory created with versions < 1.54
Chris@16 21 //#define BOOST_INTERPROCESS_BOOTSTAMP_IS_LASTBOOTUPTIME
Chris@16 22 #else
Chris@16 23 #include <unistd.h>
Chris@16 24
Chris@16 25 #if defined(_POSIX_THREAD_PROCESS_SHARED) && ((_POSIX_THREAD_PROCESS_SHARED - 0) > 0)
Chris@16 26 //Cygwin defines _POSIX_THREAD_PROCESS_SHARED but does not implement it.
Chris@16 27 #if defined(__CYGWIN__)
Chris@16 28 #define BOOST_INTERPROCESS_BUGGY_POSIX_PROCESS_SHARED
Chris@16 29 //Mac Os X < Lion (10.7) might define _POSIX_THREAD_PROCESS_SHARED but there is no real support.
Chris@16 30 #elif defined(__APPLE__)
Chris@16 31 #include "TargetConditionals.h"
Chris@16 32 //Check we're on Mac OS target
Chris@16 33 #if defined(TARGET_OS_MAC)
Chris@16 34 #include "AvailabilityMacros.h"
Chris@16 35 //If minimum target for this compilation is older than Mac Os Lion, then we are out of luck
Chris@16 36 #if MAC_OS_X_VERSION_MIN_REQUIRED < 1070
Chris@16 37 #define BOOST_INTERPROCESS_BUGGY_POSIX_PROCESS_SHARED
Chris@16 38 #endif
Chris@16 39 #endif
Chris@16 40 #endif
Chris@16 41
Chris@16 42 //If buggy _POSIX_THREAD_PROCESS_SHARED is detected avoid using it
Chris@16 43 #if defined(BOOST_INTERPROCESS_BUGGY_POSIX_PROCESS_SHARED)
Chris@16 44 #undef BOOST_INTERPROCESS_BUGGY_POSIX_PROCESS_SHARED
Chris@16 45 #else
Chris@16 46 #define BOOST_INTERPROCESS_POSIX_PROCESS_SHARED
Chris@16 47 #endif
Chris@16 48 #endif
Chris@16 49
Chris@16 50 #if defined(_POSIX_BARRIERS) && ((_POSIX_BARRIERS - 0) > 0)
Chris@16 51 #define BOOST_INTERPROCESS_POSIX_BARRIERS
Chris@16 52 #endif
Chris@16 53
Chris@16 54 #if defined(_POSIX_SEMAPHORES) && ((_POSIX_SEMAPHORES - 0) > 0)
Chris@16 55 #define BOOST_INTERPROCESS_POSIX_NAMED_SEMAPHORES
Chris@16 56 #if defined(__CYGWIN__)
Chris@16 57 #define BOOST_INTERPROCESS_POSIX_SEMAPHORES_NO_UNLINK
Chris@16 58 #endif
Chris@16 59 //Some platforms have a limited (name length) named semaphore support
Chris@16 60 #elif (defined(__FreeBSD__) && (__FreeBSD__ >= 4)) || defined(__APPLE__)
Chris@16 61 #define BOOST_INTERPROCESS_POSIX_NAMED_SEMAPHORES
Chris@16 62 #endif
Chris@16 63
Chris@16 64 #if ((defined _V6_ILP32_OFFBIG) &&(_V6_ILP32_OFFBIG - 0 > 0)) ||\
Chris@16 65 ((defined _V6_LP64_OFF64) &&(_V6_LP64_OFF64 - 0 > 0)) ||\
Chris@16 66 ((defined _V6_LPBIG_OFFBIG) &&(_V6_LPBIG_OFFBIG - 0 > 0)) ||\
Chris@16 67 ((defined _XBS5_ILP32_OFFBIG)&&(_XBS5_ILP32_OFFBIG - 0 > 0)) ||\
Chris@16 68 ((defined _XBS5_LP64_OFF64) &&(_XBS5_LP64_OFF64 - 0 > 0)) ||\
Chris@16 69 ((defined _XBS5_LPBIG_OFFBIG)&&(_XBS5_LPBIG_OFFBIG - 0 > 0)) ||\
Chris@16 70 ((defined _FILE_OFFSET_BITS) &&(_FILE_OFFSET_BITS - 0 >= 64))||\
Chris@16 71 ((defined _FILE_OFFSET_BITS) &&(_FILE_OFFSET_BITS - 0 >= 64))
Chris@16 72 #define BOOST_INTERPROCESS_UNIX_64_BIT_OR_BIGGER_OFF_T
Chris@16 73 #endif
Chris@16 74
Chris@16 75 //Check for XSI shared memory objects. They are available in nearly all UNIX platforms
Chris@16 76 #if !defined(__QNXNTO__)
Chris@16 77 #define BOOST_INTERPROCESS_XSI_SHARED_MEMORY_OBJECTS
Chris@16 78 #endif
Chris@16 79
Chris@16 80 #if defined(_POSIX_SHARED_MEMORY_OBJECTS) && ((_POSIX_SHARED_MEMORY_OBJECTS - 0) > 0)
Chris@16 81 #define BOOST_INTERPROCESS_POSIX_SHARED_MEMORY_OBJECTS
Chris@16 82 #else
Chris@16 83 //VMS and MACOS don't define it but they have shm_open/close interface
Chris@16 84 #if defined(__vms)
Chris@16 85 #if __CRTL_VER >= 70200000
Chris@16 86 #define BOOST_INTERPROCESS_POSIX_SHARED_MEMORY_OBJECTS
Chris@16 87 #endif
Chris@16 88 //Mac OS has some non-conformant features like names limited to SHM_NAME_MAX
Chris@16 89 #elif defined (__APPLE__)
Chris@16 90 //#define BOOST_INTERPROCESS_POSIX_SHARED_MEMORY_OBJECTS
Chris@16 91 //#define BOOST_INTERPROCESS_POSIX_SHARED_MEMORY_OBJECTS_NO_GROW
Chris@16 92 #endif
Chris@16 93 #endif
Chris@16 94
Chris@16 95 //Now check if we have only XSI shared memory
Chris@16 96 #if defined(BOOST_INTERPROCESS_XSI_SHARED_MEMORY_OBJECTS) &&\
Chris@16 97 !defined(BOOST_INTERPROCESS_POSIX_SHARED_MEMORY_OBJECTS)
Chris@16 98 //#define BOOST_INTERPROCESS_XSI_SHARED_MEMORY_OBJECTS_ONLY
Chris@16 99 #endif
Chris@16 100
Chris@16 101 #if defined(_POSIX_TIMEOUTS) && ((_POSIX_TIMEOUTS - 0) > 0)
Chris@16 102 #define BOOST_INTERPROCESS_POSIX_TIMEOUTS
Chris@16 103 #endif
Chris@16 104
Chris@16 105 #ifdef BOOST_INTERPROCESS_POSIX_SHARED_MEMORY_OBJECTS
Chris@16 106 //Some systems have filesystem-based resources, so the
Chris@16 107 //portable "/shmname" format does not work due to permission issues
Chris@16 108 //For those systems we need to form a path to a temporary directory:
Chris@16 109 // hp-ux tru64 vms freebsd
Chris@16 110 #if defined(__hpux) || defined(__osf__) || defined(__vms) || (defined(__FreeBSD__) && (__FreeBSD__ < 7))
Chris@16 111 #define BOOST_INTERPROCESS_FILESYSTEM_BASED_POSIX_SHARED_MEMORY
Chris@16 112 //Some systems have "jailed" environments where shm usage is restricted at runtime
Chris@16 113 //and temporary file file based shm is possible in those executions.
Chris@16 114 #elif defined(__FreeBSD__)
Chris@16 115 #define BOOST_INTERPROCESS_RUNTIME_FILESYSTEM_BASED_POSIX_SHARED_MEMORY
Chris@16 116 #endif
Chris@16 117 #endif
Chris@16 118
Chris@16 119 #ifdef BOOST_INTERPROCESS_POSIX_NAMED_SEMAPHORES
Chris@16 120 #if defined(__osf__) || defined(__vms)
Chris@16 121 #define BOOST_INTERPROCESS_FILESYSTEM_BASED_POSIX_SEMAPHORES
Chris@16 122 #endif
Chris@16 123 #endif
Chris@16 124
Chris@16 125 #if defined(_POSIX_VERSION) && defined(_XOPEN_VERSION) && \
Chris@16 126 (((_POSIX_VERSION + 0)>= 200112L || (_XOPEN_VERSION + 0)>= 500))
Chris@16 127 #define BOOST_INTERPROCESS_POSIX_RECURSIVE_MUTEXES
Chris@16 128 #endif
Chris@16 129
Chris@16 130 #if defined(__FreeBSD__) || defined(__NetBSD__) || defined(__OpenBSD__) || defined(__APPLE__)
Chris@16 131 #define BOOST_INTERPROCESS_BSD_DERIVATIVE
Chris@16 132 //Some *BSD systems (OpenBSD & NetBSD) need sys/param.h before sys/sysctl.h, whereas
Chris@16 133 //others (FreeBSD & Darwin) need sys/types.h
Chris@16 134 #include <sys/types.h>
Chris@16 135 #include <sys/param.h>
Chris@16 136 #include <sys/sysctl.h>
Chris@16 137 #if defined(CTL_KERN) && defined (KERN_BOOTTIME)
Chris@16 138 //#define BOOST_INTERPROCESS_HAS_KERNEL_BOOTTIME
Chris@16 139 #endif
Chris@16 140 #endif
Chris@16 141 #endif //!defined(BOOST_INTERPROCESS_WINDOWS)
Chris@16 142
Chris@16 143 #if !defined(BOOST_NO_CXX11_RVALUE_REFERENCES) && !defined(BOOST_NO_CXX11_VARIADIC_TEMPLATES)
Chris@16 144 #define BOOST_INTERPROCESS_PERFECT_FORWARDING
Chris@16 145 #endif
Chris@16 146
Chris@16 147 //Now declare some Boost.Interprocess features depending on the implementation
Chris@16 148 #if defined(BOOST_INTERPROCESS_POSIX_NAMED_SEMAPHORES) && !defined(BOOST_INTERPROCESS_POSIX_SEMAPHORES_NO_UNLINK)
Chris@16 149 #define BOOST_INTERPROCESS_NAMED_MUTEX_USES_POSIX_SEMAPHORES
Chris@16 150 #define BOOST_INTERPROCESS_NAMED_SEMAPHORE_USES_POSIX_SEMAPHORES
Chris@16 151 #endif
Chris@16 152
Chris@16 153 // Timeout duration use if BOOST_INTERPROCESS_ENABLE_TIMEOUT_WHEN_LOCKING is set
Chris@16 154 #ifndef BOOST_INTERPROCESS_TIMEOUT_WHEN_LOCKING_DURATION_MS
Chris@16 155 #define BOOST_INTERPROCESS_TIMEOUT_WHEN_LOCKING_DURATION_MS 10000
Chris@16 156 #endif
Chris@16 157
Chris@16 158 //Other switches
Chris@16 159 //BOOST_INTERPROCESS_MSG_QUEUE_USES_CIRC_INDEX
Chris@16 160 //message queue uses a circular queue as index instead of an array (better performance)
Chris@16 161 //Boost version < 1.52 uses an array, so undef this if you want to communicate
Chris@16 162 //with processes compiled with those versions.
Chris@16 163 #define BOOST_INTERPROCESS_MSG_QUEUE_CIRCULAR_INDEX
Chris@16 164
Chris@16 165 //Inline attributes
Chris@16 166 #if defined(_MSC_VER)
Chris@16 167 #define BOOST_INTERPROCESS_ALWAYS_INLINE __forceinline
Chris@16 168 #elif defined (__GNUC__)
Chris@16 169 #define BOOST_INTERPROCESS_ALWAYS_INLINE __attribute__((__always_inline__))
Chris@16 170 #else
Chris@16 171 #define BOOST_INTERPROCESS_ALWAYS_INLINE inline
Chris@16 172 #endif
Chris@16 173
Chris@16 174 #if defined(_MSC_VER)
Chris@16 175 #define BOOST_INTERPROCESS_NEVER_INLINE __declspec(noinline)
Chris@16 176 #elif defined (__GNUC__)
Chris@16 177 #define BOOST_INTERPROCESS_NEVER_INLINE __attribute__((__noinline__))
Chris@16 178 #endif
Chris@16 179
Chris@16 180 #if defined(BOOST_NO_CXX11_NOEXCEPT)
Chris@16 181 #if defined(BOOST_MSVC)
Chris@16 182 #define BOOST_INTERPROCESS_NOEXCEPT throw()
Chris@16 183 #else
Chris@16 184 #define BOOST_INTERPROCESS_NOEXCEPT
Chris@16 185 #endif
Chris@16 186 #define BOOST_INTERPROCESS_NOEXCEPT_IF(x)
Chris@16 187 #else
Chris@16 188 #define BOOST_INTERPROCESS_NOEXCEPT noexcept
Chris@16 189 #define BOOST_INTERPROCESS_NOEXCEPT_IF(x) noexcept(x)
Chris@16 190 #endif
Chris@16 191
Chris@16 192 #include <boost/interprocess/detail/config_end.hpp>
Chris@16 193
Chris@16 194 #endif //#ifndef BOOST_INTERPROCESS_DETAIL_WORKAROUND_HPP