]> git.proxmox.com Git - ceph.git/blame - ceph/src/boost/boost/interprocess/detail/workaround.hpp
update sources to v12.2.3
[ceph.git] / ceph / src / boost / boost / interprocess / detail / workaround.hpp
CommitLineData
7c673cae
FG
1//////////////////////////////////////////////////////////////////////////////
2//
3// (C) Copyright Ion Gaztanaga 2005-2015. Distributed under the Boost
4// Software License, Version 1.0. (See accompanying file
5// LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
6//
7// See http://www.boost.org/libs/interprocess for documentation.
8//
9//////////////////////////////////////////////////////////////////////////////
10
11#ifndef BOOST_INTERPROCESS_DETAIL_WORKAROUND_HPP
12#define BOOST_INTERPROCESS_DETAIL_WORKAROUND_HPP
13
14#ifndef BOOST_CONFIG_HPP
15# include <boost/config.hpp>
16#endif
17#
18#if defined(BOOST_HAS_PRAGMA_ONCE)
19# pragma once
20#endif
21
22#if defined(_WIN32) || defined(__WIN32__) || defined(WIN32)
23 #define BOOST_INTERPROCESS_WINDOWS
24 #define BOOST_INTERPROCESS_FORCE_GENERIC_EMULATION
25 #define BOOST_INTERPROCESS_HAS_KERNEL_BOOTTIME
26 //Define this to connect with shared memory created with versions < 1.54
27 //#define BOOST_INTERPROCESS_BOOTSTAMP_IS_LASTBOOTUPTIME
28#else
29 #include <unistd.h>
30
31 //////////////////////////////////////////////////////
32 //Check for XSI shared memory objects. They are available in nearly all UNIX platforms
33 //////////////////////////////////////////////////////
34 #if !defined(__QNXNTO__) && !defined(__ANDROID__) && !defined(__HAIKU__)
35 #define BOOST_INTERPROCESS_XSI_SHARED_MEMORY_OBJECTS
36 #endif
37
38 //////////////////////////////////////////////////////
39 // From SUSv3/UNIX 98, pthread_mutexattr_settype is mandatory
40 //////////////////////////////////////////////////////
41 #if defined(_XOPEN_UNIX) && ((_XOPEN_VERSION + 0) >= 500)
42 #define BOOST_INTERPROCESS_POSIX_RECURSIVE_MUTEXES
43 #endif
44
45 //////////////////////////////////////////////////////
46 // _POSIX_THREAD_PROCESS_SHARED (POSIX.1b/POSIX.4)
47 //////////////////////////////////////////////////////
48 #if defined(_POSIX_THREAD_PROCESS_SHARED) && ((_POSIX_THREAD_PROCESS_SHARED + 0) > 0)
49 //Cygwin defines _POSIX_THREAD_PROCESS_SHARED but does not implement it.
50 #if defined(__CYGWIN__)
51 #define BOOST_INTERPROCESS_BUGGY_POSIX_PROCESS_SHARED
52 //Mac Os X < Lion (10.7) might define _POSIX_THREAD_PROCESS_SHARED but there is no real support.
53 #elif defined(__APPLE__)
54 #include "TargetConditionals.h"
55 //Check we're on Mac OS target
56 #if defined(TARGET_OS_MAC)
57 #include "AvailabilityMacros.h"
58 //If minimum target for this compilation is older than Mac Os Lion, then we are out of luck
59 #if MAC_OS_X_VERSION_MIN_REQUIRED < 1070
60 #define BOOST_INTERPROCESS_BUGGY_POSIX_PROCESS_SHARED
61 #endif
62 #endif
63 #endif
64
65 //If buggy _POSIX_THREAD_PROCESS_SHARED is detected avoid using it
66 #if defined(BOOST_INTERPROCESS_BUGGY_POSIX_PROCESS_SHARED)
67 #undef BOOST_INTERPROCESS_BUGGY_POSIX_PROCESS_SHARED
68 #else
69 #define BOOST_INTERPROCESS_POSIX_PROCESS_SHARED
70 #endif
71 #endif
72
73 //////////////////////////////////////////////////////
74 // _POSIX_SHARED_MEMORY_OBJECTS (POSIX.1b/POSIX.4)
75 //////////////////////////////////////////////////////
76 #if ( defined(_POSIX_SHARED_MEMORY_OBJECTS) && ((_POSIX_SHARED_MEMORY_OBJECTS + 0) > 0) ) ||\
77 (defined(__vms) && __CRTL_VER >= 70200000)
78 #define BOOST_INTERPROCESS_POSIX_SHARED_MEMORY_OBJECTS
79 //Some systems have filesystem-based resources, so the
80 //portable "/shmname" format does not work due to permission issues
81 //For those systems we need to form a path to a temporary directory:
82 // hp-ux tru64 vms freebsd
83 #if defined(__hpux) || defined(__osf__) || defined(__vms) || (defined(__FreeBSD__) && (__FreeBSD__ < 7))
84 #define BOOST_INTERPROCESS_FILESYSTEM_BASED_POSIX_SHARED_MEMORY
85 //Some systems have "jailed" environments where shm usage is restricted at runtime
86 //and temporary file based shm is possible in those executions.
87 #elif defined(__FreeBSD__)
88 #define BOOST_INTERPROCESS_RUNTIME_FILESYSTEM_BASED_POSIX_SHARED_MEMORY
89 #endif
90 #endif
91
92 //////////////////////////////////////////////////////
93 // _POSIX_MAPPED_FILES (POSIX.1b/POSIX.4)
94 //////////////////////////////////////////////////////
95 #if defined(_POSIX_MAPPED_FILES) && ((_POSIX_MAPPED_FILES + 0) > 0)
96 #define BOOST_INTERPROCESS_POSIX_MAPPED_FILES
97 #endif
98
99 //////////////////////////////////////////////////////
100 // _POSIX_SEMAPHORES (POSIX.1b/POSIX.4)
101 //////////////////////////////////////////////////////
102 #if ( defined(_POSIX_SEMAPHORES) && ((_POSIX_SEMAPHORES + 0) > 0) ) ||\
103 ( defined(__FreeBSD__) && (__FreeBSD__ >= 4)) || \
104 defined(__APPLE__)
105 #define BOOST_INTERPROCESS_POSIX_NAMED_SEMAPHORES
106 //MacOsX declares _POSIX_SEMAPHORES but sem_init returns ENOSYS
107 #if !defined(__APPLE__)
108 #define BOOST_INTERPROCESS_POSIX_UNNAMED_SEMAPHORES
109 #endif
110 #if defined(__osf__) || defined(__vms)
111 #define BOOST_INTERPROCESS_FILESYSTEM_BASED_POSIX_SEMAPHORES
112 #endif
113 #endif
114
115 //////////////////////////////////////////////////////
116 // _POSIX_BARRIERS (SUSv3/Unix03)
117 //////////////////////////////////////////////////////
118 #if defined(_POSIX_BARRIERS) && ((_POSIX_BARRIERS + 0) >= 200112L)
119 #define BOOST_INTERPROCESS_POSIX_BARRIERS
120 #endif
121
122 //////////////////////////////////////////////////////
123 // _POSIX_TIMEOUTS (SUSv3/Unix03)
124 //////////////////////////////////////////////////////
125 #if defined(_POSIX_TIMEOUTS) && ((_POSIX_TIMEOUTS + 0L) >= 200112L)
126 #define BOOST_INTERPROCESS_POSIX_TIMEOUTS
127 #endif
128
129 //////////////////////////////////////////////////////
130 // Detect BSD derivatives to detect sysctl
131 //////////////////////////////////////////////////////
132 #if defined(__FreeBSD__) || defined(__NetBSD__) || defined(__OpenBSD__) || defined(__APPLE__)
133 #define BOOST_INTERPROCESS_BSD_DERIVATIVE
134 //Some *BSD systems (OpenBSD & NetBSD) need sys/param.h before sys/sysctl.h, whereas
135 //others (FreeBSD & Darwin) need sys/types.h
136 #include <sys/types.h>
137 #include <sys/param.h>
138 #include <sys/sysctl.h>
139 #if defined(CTL_KERN) && defined (KERN_BOOTTIME)
140 //#define BOOST_INTERPROCESS_HAS_KERNEL_BOOTTIME
141 #endif
142 #endif
143
144 //////////////////////////////////////////////////////
145 //64 bit offset
146 //////////////////////////////////////////////////////
147 #if (defined (_V6_ILP32_OFFBIG) &&(_V6_ILP32_OFFBIG - 0 > 0)) ||\
148 (defined (_V6_LP64_OFF64) &&(_V6_LP64_OFF64 - 0 > 0)) ||\
149 (defined (_V6_LPBIG_OFFBIG) &&(_V6_LPBIG_OFFBIG - 0 > 0)) ||\
150 (defined (_XBS5_ILP32_OFFBIG)&&(_XBS5_ILP32_OFFBIG - 0 > 0)) ||\
151 (defined (_XBS5_LP64_OFF64) &&(_XBS5_LP64_OFF64 - 0 > 0)) ||\
152 (defined (_XBS5_LPBIG_OFFBIG)&&(_XBS5_LPBIG_OFFBIG - 0 > 0)) ||\
153 (defined (_FILE_OFFSET_BITS) &&(_FILE_OFFSET_BITS - 0 >= 64))||\
154 (defined (_FILE_OFFSET_BITS) &&(_FILE_OFFSET_BITS - 0 >= 64))
155 #define BOOST_INTERPROCESS_UNIX_64_BIT_OR_BIGGER_OFF_T
156 #endif
157#endif //!defined(BOOST_INTERPROCESS_WINDOWS)
158
159#if defined(BOOST_INTERPROCESS_WINDOWS) || defined(BOOST_INTERPROCESS_POSIX_MAPPED_FILES)
160# define BOOST_INTERPROCESS_MAPPED_FILES
161#endif
162
163//Now declare some Boost.Interprocess features depending on the implementation
164#if defined(BOOST_INTERPROCESS_POSIX_NAMED_SEMAPHORES) && !defined(BOOST_INTERPROCESS_POSIX_SEMAPHORES_NO_UNLINK)
165 #define BOOST_INTERPROCESS_NAMED_MUTEX_USES_POSIX_SEMAPHORES
166 #define BOOST_INTERPROCESS_NAMED_SEMAPHORE_USES_POSIX_SEMAPHORES
167#endif
168
169#if !defined(BOOST_NO_CXX11_RVALUE_REFERENCES) && !defined(BOOST_NO_CXX11_VARIADIC_TEMPLATES)
170 #define BOOST_INTERPROCESS_PERFECT_FORWARDING
171#endif
172
173// Timeout duration use if BOOST_INTERPROCESS_ENABLE_TIMEOUT_WHEN_LOCKING is set
174#ifndef BOOST_INTERPROCESS_TIMEOUT_WHEN_LOCKING_DURATION_MS
175 #define BOOST_INTERPROCESS_TIMEOUT_WHEN_LOCKING_DURATION_MS 10000
176#endif
177
178//Other switches
179//BOOST_INTERPROCESS_MSG_QUEUE_USES_CIRC_INDEX
180//message queue uses a circular queue as index instead of an array (better performance)
181//Boost version < 1.52 uses an array, so undef this if you want to communicate
182//with processes compiled with those versions.
183#define BOOST_INTERPROCESS_MSG_QUEUE_CIRCULAR_INDEX
184
185//Macros for documentation purposes. For code, expands to the argument
186#define BOOST_INTERPROCESS_IMPDEF(TYPE) TYPE
187#define BOOST_INTERPROCESS_SEEDOC(TYPE) TYPE
188#define BOOST_INTERPROCESS_DOC1ST(TYPE1, TYPE2) TYPE2
189#define BOOST_INTERPROCESS_I ,
190#define BOOST_INTERPROCESS_DOCIGN(T1) T1
191
192//#define BOOST_INTERPROCESS_DISABLE_FORCEINLINE
193
194#if defined(BOOST_INTERPROCESS_DISABLE_FORCEINLINE)
195 #define BOOST_INTERPROCESS_FORCEINLINE inline
196#elif defined(BOOST_INTERPROCESS_FORCEINLINE_IS_BOOST_FORCELINE)
197 #define BOOST_INTERPROCESS_FORCEINLINE BOOST_FORCEINLINE
198#elif defined(BOOST_MSVC) && defined(_DEBUG)
199 //"__forceinline" and MSVC seems to have some bugs in debug mode
200 #define BOOST_INTERPROCESS_FORCEINLINE inline
b32b8144
FG
201#elif defined(__GNUC__) && ((__GNUC__ < 4) || (__GNUC__ == 4 && (__GNUC_MINOR__ < 5)))
202 //Older GCCs have problems with forceinline
203 #define BOOST_INTERPROCESS_FORCEINLINE inline
7c673cae
FG
204#else
205 #define BOOST_INTERPROCESS_FORCEINLINE BOOST_FORCEINLINE
206#endif
207
208#endif //#ifndef BOOST_INTERPROCESS_DETAIL_WORKAROUND_HPP