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