File indexing completed on 2025-01-18 09:38:35
0001
0002
0003
0004
0005
0006
0007
0008
0009
0010
0011 #ifndef BOOST_INTERPROCESS_PERMISSIONS_HPP
0012 #define BOOST_INTERPROCESS_PERMISSIONS_HPP
0013
0014 #if !defined(BOOST_INTERPROCESS_DOXYGEN_INVOKED)
0015
0016 #ifndef BOOST_CONFIG_HPP
0017 # include <boost/config.hpp>
0018 #endif
0019 #
0020 #if defined(BOOST_HAS_PRAGMA_ONCE)
0021 # pragma once
0022 #endif
0023
0024 #include <boost/interprocess/detail/config_begin.hpp>
0025 #include <boost/interprocess/detail/workaround.hpp>
0026 #include <boost/interprocess/interprocess_fwd.hpp>
0027
0028 #if defined(BOOST_INTERPROCESS_WINDOWS)
0029
0030 #include <boost/interprocess/detail/win32_api.hpp>
0031
0032 #else
0033
0034 #include <sys/stat.h>
0035
0036 #endif
0037
0038 #endif
0039
0040
0041
0042
0043 namespace boost {
0044 namespace interprocess {
0045
0046 #if !defined(BOOST_INTERPROCESS_DOXYGEN_INVOKED)
0047
0048 #if defined(BOOST_INTERPROCESS_WINDOWS)
0049
0050 namespace ipcdetail {
0051
0052 template <int Dummy>
0053 struct unrestricted_permissions_holder
0054 {
0055 static winapi::interprocess_all_access_security unrestricted;
0056 };
0057
0058 template<int Dummy>
0059 winapi::interprocess_all_access_security unrestricted_permissions_holder<Dummy>::unrestricted;
0060
0061 }
0062
0063 #endif
0064
0065 #endif
0066
0067
0068
0069
0070 class permissions
0071 {
0072 #if !defined(BOOST_INTERPROCESS_DOXYGEN_INVOKED)
0073
0074 #if defined(BOOST_INTERPROCESS_WINDOWS)
0075 typedef void* os_permissions_type;
0076 #else
0077 typedef ::mode_t os_permissions_type;
0078 #endif
0079 os_permissions_type m_perm;
0080
0081 #endif
0082
0083 public:
0084
0085
0086 permissions(os_permissions_type type) BOOST_NOEXCEPT
0087 : m_perm(type)
0088 {}
0089
0090
0091
0092
0093 permissions() BOOST_NOEXCEPT
0094 { set_default(); }
0095
0096
0097
0098
0099 void set_default() BOOST_NOEXCEPT
0100 {
0101 #if defined (BOOST_INTERPROCESS_WINDOWS)
0102 m_perm = 0;
0103 #else
0104 m_perm = 0644;
0105 #endif
0106 }
0107
0108
0109
0110 void set_unrestricted() BOOST_NOEXCEPT
0111 {
0112 #if defined (BOOST_INTERPROCESS_WINDOWS)
0113 m_perm = &ipcdetail::unrestricted_permissions_holder<0>::unrestricted;
0114 #else
0115 m_perm = 0666;
0116 #endif
0117 }
0118
0119
0120
0121 void set_permissions(os_permissions_type perm) BOOST_NOEXCEPT
0122 { m_perm = perm; }
0123
0124
0125
0126 os_permissions_type get_permissions() const BOOST_NOEXCEPT
0127 { return m_perm; }
0128 };
0129
0130 }
0131 }
0132
0133 #include <boost/interprocess/detail/config_end.hpp>
0134
0135 #endif
0136