PageRenderTime 20ms CodeModel.GetById 14ms app.highlight 3ms RepoModel.GetById 1ms app.codeStats 0ms

/Src/Dependencies/Boost/boost/interprocess/detail/workaround.hpp

http://hadesmem.googlecode.com/
C++ Header | 143 lines | 83 code | 31 blank | 29 comment | 19 complexity | 54a53177668894ce45cfeda94061bf93 MD5 | raw file
  1//////////////////////////////////////////////////////////////////////////////
  2//
  3// (C) Copyright Ion Gaztanaga 2005-2009. 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#include <boost/interprocess/detail/config_begin.hpp>
 15
 16#if (defined(_WIN32) || defined(__WIN32__) || defined(WIN32))
 17
 18#define BOOST_INTERPROCESS_WINDOWS
 19
 20/*
 21#if !defined(_MSC_EXTENSIONS)
 22#error "Turn on Microsoft language extensions (_MSC_EXTENSIONS) to be able to call Windows API functions"
 23#endif
 24*/
 25
 26#endif
 27
 28#if !(defined BOOST_INTERPROCESS_WINDOWS)
 29
 30   #include <unistd.h>
 31
 32   #if ((_POSIX_THREAD_PROCESS_SHARED - 0) > 0)
 33   //Cygwin defines _POSIX_THREAD_PROCESS_SHARED but does not implement it.
 34   //Mac Os X >= Leopard defines _POSIX_THREAD_PROCESS_SHARED but does not seems to work.
 35   #  if !defined(__CYGWIN__) && !defined(__APPLE__)
 36   #  define BOOST_INTERPROCESS_POSIX_PROCESS_SHARED
 37   #  endif
 38   #endif
 39   
 40   #if ((_POSIX_BARRIERS - 0) > 0)
 41   # define BOOST_INTERPROCESS_POSIX_BARRIERS
 42   # endif
 43
 44   #if ((_POSIX_SEMAPHORES - 0) > 0)
 45   # define BOOST_INTERPROCESS_POSIX_NAMED_SEMAPHORES
 46   #  if defined(__CYGWIN__)
 47      #define BOOST_INTERPROCESS_POSIX_SEMAPHORES_NO_UNLINK
 48   #  endif
 49   //Some platforms have a limited (name length) named semaphore support
 50   #elif (defined(__FreeBSD__) && (__FreeBSD__ >= 4)) || defined(__APPLE__)
 51     # define BOOST_INTERPROCESS_POSIX_NAMED_SEMAPHORES   
 52   #endif 
 53
 54   #if ((defined _V6_ILP32_OFFBIG)  &&(_V6_ILP32_OFFBIG   - 0 > 0)) ||\
 55       ((defined _V6_LP64_OFF64)    &&(_V6_LP64_OFF64     - 0 > 0)) ||\
 56       ((defined _V6_LPBIG_OFFBIG)  &&(_V6_LPBIG_OFFBIG   - 0 > 0)) ||\
 57       ((defined _XBS5_ILP32_OFFBIG)&&(_XBS5_ILP32_OFFBIG - 0 > 0)) ||\
 58       ((defined _XBS5_LP64_OFF64)  &&(_XBS5_LP64_OFF64   - 0 > 0)) ||\
 59       ((defined _XBS5_LPBIG_OFFBIG)&&(_XBS5_LPBIG_OFFBIG - 0 > 0)) ||\
 60       ((defined _FILE_OFFSET_BITS) &&(_FILE_OFFSET_BITS  - 0 >= 64))||\
 61       ((defined _FILE_OFFSET_BITS) &&(_FILE_OFFSET_BITS  - 0 >= 64))
 62      #define BOOST_INTERPROCESS_UNIX_64_BIT_OR_BIGGER_OFF_T
 63   #else
 64   #endif
 65
 66   //Check for XSI shared memory objects. They are available in nearly all UNIX platforms
 67   #if !defined(__QNXNTO__)
 68   # define BOOST_INTERPROCESS_XSI_SHARED_MEMORY_OBJECTS
 69   #endif
 70
 71   #if ((_POSIX_SHARED_MEMORY_OBJECTS - 0) > 0)
 72   # define BOOST_INTERPROCESS_POSIX_SHARED_MEMORY_OBJECTS
 73   #else
 74   //VMS and MACOS don't define it but the have shm_open/close interface
 75   # if defined(__vms)
 76   #  if __CRTL_VER >= 70200000
 77   #  define BOOST_INTERPROCESS_POSIX_SHARED_MEMORY_OBJECTS
 78   #  endif
 79   //Mac OS has some non-conformant features like names limited to SHM_NAME_MAX
 80   # elif defined (__APPLE__)
 81//   #  define BOOST_INTERPROCESS_POSIX_SHARED_MEMORY_OBJECTS
 82//   #  define BOOST_INTERPROCESS_POSIX_SHARED_MEMORY_OBJECTS_NO_GROW
 83   # endif 
 84   #endif
 85
 86   //Now check if we have only XSI shared memory
 87   #if defined(BOOST_INTERPROCESS_XSI_SHARED_MEMORY_OBJECTS) &&\
 88      !defined(BOOST_INTERPROCESS_POSIX_SHARED_MEMORY_OBJECTS)
 89   //#  define BOOST_INTERPROCESS_XSI_SHARED_MEMORY_OBJECTS_ONLY
 90   #endif
 91
 92   #if ((_POSIX_TIMEOUTS - 0) > 0)
 93   # define BOOST_INTERPROCESS_POSIX_TIMEOUTS
 94   #endif 
 95
 96
 97   #ifdef BOOST_INTERPROCESS_POSIX_SHARED_MEMORY_OBJECTS
 98      //Some systems have filesystem-based resources, so the
 99      //portable "/shmname" format does not work due to permission issues
100      //For those systems we need to form a path to a temporary directory:
101      //          hp-ux               tru64               vms               freebsd
102      #if defined(__hpux) || defined(__osf__) || defined(__vms) || (defined(__FreeBSD__) && (__FreeBSD__ < 7)) 
103      #define BOOST_INTERPROCESS_FILESYSTEM_BASED_POSIX_SHARED_MEMORY
104      #elif defined(__FreeBSD__)
105      #define BOOST_INTERPROCESS_RUNTIME_FILESYSTEM_BASED_POSIX_SHARED_MEMORY
106      #endif
107   #endif
108
109   #ifdef BOOST_INTERPROCESS_POSIX_NAMED_SEMAPHORES
110      #if defined(__osf__) || defined(__vms)
111      #define BOOST_INTERPROCESS_FILESYSTEM_BASED_POSIX_SEMAPHORES
112      #endif
113   #endif
114
115   #if ((_POSIX_VERSION + 0)>= 200112L || (_XOPEN_VERSION + 0)>= 500)
116   #define BOOST_INTERPROCESS_POSIX_RECURSIVE_MUTEXES
117   #endif
118
119#endif
120
121#if    !defined(BOOST_NO_RVALUE_REFERENCES) && !defined(BOOST_NO_VARIADIC_TEMPLATES)\
122    && !defined(BOOST_INTERPROCESS_DISABLE_VARIADIC_TMPL)
123#define BOOST_INTERPROCESS_PERFECT_FORWARDING
124#endif
125
126//Now declare some Boost.Interprocess features depending on the implementation
127
128#if defined(BOOST_INTERPROCESS_POSIX_NAMED_SEMAPHORES) && !defined(BOOST_INTERPROCESS_POSIX_SEMAPHORES_NO_UNLINK)
129
130#define BOOST_INTERPROCESS_NAMED_MUTEX_USES_POSIX_SEMAPHORES
131
132#endif
133
134#if defined(BOOST_INTERPROCESS_POSIX_NAMED_SEMAPHORES) && !defined(BOOST_INTERPROCESS_POSIX_SEMAPHORES_NO_UNLINK)
135
136#define BOOST_INTERPROCESS_NAMED_MUTEX_USES_POSIX_SEMAPHORES
137#define BOOST_INTERPROCESS_NAMED_SEMAPHORE_USES_POSIX_SEMAPHORES
138
139#endif
140
141#include <boost/interprocess/detail/config_end.hpp>
142
143#endif   //#ifndef BOOST_INTERPROCESS_DETAIL_WORKAROUND_HPP