summaryrefslogtreecommitdiff
path: root/boost/interprocess/detail/workaround.hpp
diff options
context:
space:
mode:
Diffstat (limited to 'boost/interprocess/detail/workaround.hpp')
-rw-r--r--boost/interprocess/detail/workaround.hpp133
1 files changed, 60 insertions, 73 deletions
diff --git a/boost/interprocess/detail/workaround.hpp b/boost/interprocess/detail/workaround.hpp
index 896a2208a2..884b8680a6 100644
--- a/boost/interprocess/detail/workaround.hpp
+++ b/boost/interprocess/detail/workaround.hpp
@@ -13,43 +13,34 @@
#include <boost/interprocess/detail/config_begin.hpp>
-#if (defined(_WIN32) || defined(__WIN32__) || defined(WIN32))
-
-#define BOOST_INTERPROCESS_WINDOWS
-
-/*
-#if !defined(_MSC_EXTENSIONS)
-#error "Turn on Microsoft language extensions (_MSC_EXTENSIONS) to be able to call Windows API functions"
-#endif
-*/
-
-#endif
-
-#if !defined(BOOST_INTERPROCESS_WINDOWS)
-
+#if defined(_WIN32) || defined(__WIN32__) || defined(WIN32)
+ #define BOOST_INTERPROCESS_WINDOWS
+ #define BOOST_INTERPROCESS_FORCE_GENERIC_EMULATION
+ #define BOOST_INTERPROCESS_HAS_KERNEL_BOOTTIME
+#else
#include <unistd.h>
- #if ((_POSIX_THREAD_PROCESS_SHARED - 0) > 0)
- //Cygwin defines _POSIX_THREAD_PROCESS_SHARED but does not implement it.
- //Mac Os X >= Leopard defines _POSIX_THREAD_PROCESS_SHARED but does not seems to work.
- # if !defined(__CYGWIN__) && !defined(__APPLE__)
- # define BOOST_INTERPROCESS_POSIX_PROCESS_SHARED
- # endif
+ #if defined(_POSIX_THREAD_PROCESS_SHARED) && ((_POSIX_THREAD_PROCESS_SHARED - 0) > 0)
+ //Cygwin defines _POSIX_THREAD_PROCESS_SHARED but does not implement it.
+ //Mac Os X >= Leopard defines _POSIX_THREAD_PROCESS_SHARED but does not seems to work.
+ #if !defined(__CYGWIN__) && !defined(__APPLE__)
+ #define BOOST_INTERPROCESS_POSIX_PROCESS_SHARED
+ #endif
+ #endif
+
+ #if defined(_POSIX_BARRIERS) && ((_POSIX_BARRIERS - 0) > 0)
+ #define BOOST_INTERPROCESS_POSIX_BARRIERS
#endif
-
- #if ((_POSIX_BARRIERS - 0) > 0)
- # define BOOST_INTERPROCESS_POSIX_BARRIERS
- # endif
-
- #if ((_POSIX_SEMAPHORES - 0) > 0)
- # define BOOST_INTERPROCESS_POSIX_NAMED_SEMAPHORES
- # if defined(__CYGWIN__)
- #define BOOST_INTERPROCESS_POSIX_SEMAPHORES_NO_UNLINK
- # endif
+
+ #if defined(_POSIX_SEMAPHORES) && ((_POSIX_SEMAPHORES - 0) > 0)
+ #define BOOST_INTERPROCESS_POSIX_NAMED_SEMAPHORES
+ #if defined(__CYGWIN__)
+ #define BOOST_INTERPROCESS_POSIX_SEMAPHORES_NO_UNLINK
+ #endif
//Some platforms have a limited (name length) named semaphore support
#elif (defined(__FreeBSD__) && (__FreeBSD__ >= 4)) || defined(__APPLE__)
- # define BOOST_INTERPROCESS_POSIX_NAMED_SEMAPHORES
- #endif
+ #define BOOST_INTERPROCESS_POSIX_NAMED_SEMAPHORES
+ #endif
#if ((defined _V6_ILP32_OFFBIG) &&(_V6_ILP32_OFFBIG - 0 > 0)) ||\
((defined _V6_LP64_OFF64) &&(_V6_LP64_OFF64 - 0 > 0)) ||\
@@ -60,87 +51,83 @@
((defined _FILE_OFFSET_BITS) &&(_FILE_OFFSET_BITS - 0 >= 64))||\
((defined _FILE_OFFSET_BITS) &&(_FILE_OFFSET_BITS - 0 >= 64))
#define BOOST_INTERPROCESS_UNIX_64_BIT_OR_BIGGER_OFF_T
- #else
#endif
//Check for XSI shared memory objects. They are available in nearly all UNIX platforms
#if !defined(__QNXNTO__)
- # define BOOST_INTERPROCESS_XSI_SHARED_MEMORY_OBJECTS
+ #define BOOST_INTERPROCESS_XSI_SHARED_MEMORY_OBJECTS
#endif
- #if ((_POSIX_SHARED_MEMORY_OBJECTS - 0) > 0)
- # define BOOST_INTERPROCESS_POSIX_SHARED_MEMORY_OBJECTS
+ #if defined(_POSIX_SHARED_MEMORY_OBJECTS) && ((_POSIX_SHARED_MEMORY_OBJECTS - 0) > 0)
+ #define BOOST_INTERPROCESS_POSIX_SHARED_MEMORY_OBJECTS
#else
- //VMS and MACOS don't define it but the have shm_open/close interface
- # if defined(__vms)
- # if __CRTL_VER >= 70200000
- # define BOOST_INTERPROCESS_POSIX_SHARED_MEMORY_OBJECTS
- # endif
- //Mac OS has some non-conformant features like names limited to SHM_NAME_MAX
- # elif defined (__APPLE__)
-// # define BOOST_INTERPROCESS_POSIX_SHARED_MEMORY_OBJECTS
-// # define BOOST_INTERPROCESS_POSIX_SHARED_MEMORY_OBJECTS_NO_GROW
- # endif
+ //VMS and MACOS don't define it but they have shm_open/close interface
+ #if defined(__vms)
+ #if __CRTL_VER >= 70200000
+ #define BOOST_INTERPROCESS_POSIX_SHARED_MEMORY_OBJECTS
+ #endif
+ //Mac OS has some non-conformant features like names limited to SHM_NAME_MAX
+ #elif defined (__APPLE__)
+ //#define BOOST_INTERPROCESS_POSIX_SHARED_MEMORY_OBJECTS
+ //#define BOOST_INTERPROCESS_POSIX_SHARED_MEMORY_OBJECTS_NO_GROW
+ #endif
#endif
//Now check if we have only XSI shared memory
#if defined(BOOST_INTERPROCESS_XSI_SHARED_MEMORY_OBJECTS) &&\
!defined(BOOST_INTERPROCESS_POSIX_SHARED_MEMORY_OBJECTS)
- //# define BOOST_INTERPROCESS_XSI_SHARED_MEMORY_OBJECTS_ONLY
+ //#define BOOST_INTERPROCESS_XSI_SHARED_MEMORY_OBJECTS_ONLY
#endif
- #if ((_POSIX_TIMEOUTS - 0) > 0)
- # define BOOST_INTERPROCESS_POSIX_TIMEOUTS
- #endif
-
+ #if defined(_POSIX_TIMEOUTS) && ((_POSIX_TIMEOUTS - 0) > 0)
+ #define BOOST_INTERPROCESS_POSIX_TIMEOUTS
+ #endif
#ifdef BOOST_INTERPROCESS_POSIX_SHARED_MEMORY_OBJECTS
//Some systems have filesystem-based resources, so the
//portable "/shmname" format does not work due to permission issues
//For those systems we need to form a path to a temporary directory:
// hp-ux tru64 vms freebsd
- #if defined(__hpux) || defined(__osf__) || defined(__vms) || (defined(__FreeBSD__) && (__FreeBSD__ < 7))
- #define BOOST_INTERPROCESS_FILESYSTEM_BASED_POSIX_SHARED_MEMORY
+ #if defined(__hpux) || defined(__osf__) || defined(__vms) || (defined(__FreeBSD__) && (__FreeBSD__ < 7))
+ #define BOOST_INTERPROCESS_FILESYSTEM_BASED_POSIX_SHARED_MEMORY
#elif defined(__FreeBSD__)
- #define BOOST_INTERPROCESS_RUNTIME_FILESYSTEM_BASED_POSIX_SHARED_MEMORY
+ #define BOOST_INTERPROCESS_RUNTIME_FILESYSTEM_BASED_POSIX_SHARED_MEMORY
#endif
#endif
#ifdef BOOST_INTERPROCESS_POSIX_NAMED_SEMAPHORES
#if defined(__osf__) || defined(__vms)
- #define BOOST_INTERPROCESS_FILESYSTEM_BASED_POSIX_SEMAPHORES
+ #define BOOST_INTERPROCESS_FILESYSTEM_BASED_POSIX_SEMAPHORES
#endif
#endif
- #if ((_POSIX_VERSION + 0)>= 200112L || (_XOPEN_VERSION + 0)>= 500)
- #define BOOST_INTERPROCESS_POSIX_RECURSIVE_MUTEXES
+ #if defined(_POSIX_VERSION) && defined(_XOPEN_VERSION) && \
+ (((_POSIX_VERSION + 0)>= 200112L || (_XOPEN_VERSION + 0)>= 500))
+ #define BOOST_INTERPROCESS_POSIX_RECURSIVE_MUTEXES
#endif
-#endif
+ #if defined(__FreeBSD__) || defined(__NetBSD__) || defined(__OpenBSD__) || defined(__APPLE__)
+ #define BOOST_INTERPROCESS_BSD_DERIVATIVE
+ #include <sys/sysctl.h>
+ #if defined(CTL_KERN) && defined (KERN_BOOTTIME)
+ //#define BOOST_INTERPROCESS_HAS_KERNEL_BOOTTIME
+ #endif
+ #endif
+#endif //!defined(BOOST_INTERPROCESS_WINDOWS)
-#if !defined(BOOST_NO_RVALUE_REFERENCES) && !defined(BOOST_NO_VARIADIC_TEMPLATES)\
- && !defined(BOOST_INTERPROCESS_DISABLE_VARIADIC_TMPL)
-#define BOOST_INTERPROCESS_PERFECT_FORWARDING
+#if !defined(BOOST_NO_RVALUE_REFERENCES) && !defined(BOOST_NO_VARIADIC_TEMPLATES)
+ #define BOOST_INTERPROCESS_PERFECT_FORWARDING
#endif
//Now declare some Boost.Interprocess features depending on the implementation
-
#if defined(BOOST_INTERPROCESS_POSIX_NAMED_SEMAPHORES) && !defined(BOOST_INTERPROCESS_POSIX_SEMAPHORES_NO_UNLINK)
-
-#define BOOST_INTERPROCESS_NAMED_MUTEX_USES_POSIX_SEMAPHORES
-
-#endif
-
-#if defined(BOOST_INTERPROCESS_POSIX_NAMED_SEMAPHORES) && !defined(BOOST_INTERPROCESS_POSIX_SEMAPHORES_NO_UNLINK)
-
-#define BOOST_INTERPROCESS_NAMED_MUTEX_USES_POSIX_SEMAPHORES
-#define BOOST_INTERPROCESS_NAMED_SEMAPHORE_USES_POSIX_SEMAPHORES
-
+ #define BOOST_INTERPROCESS_NAMED_MUTEX_USES_POSIX_SEMAPHORES
+ #define BOOST_INTERPROCESS_NAMED_SEMAPHORE_USES_POSIX_SEMAPHORES
#endif
// Timeout duration use if BOOST_INTERPROCESS_ENABLE_TIMEOUT_WHEN_LOCKING is set
#ifndef BOOST_INTERPROCESS_TIMEOUT_WHEN_LOCKING_DURATION_MS
-#define BOOST_INTERPROCESS_TIMEOUT_WHEN_LOCKING_DURATION_MS 10000
+ #define BOOST_INTERPROCESS_TIMEOUT_WHEN_LOCKING_DURATION_MS 10000
#endif
#include <boost/interprocess/detail/config_end.hpp>