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