123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132 |
- #ifndef BOOST_INTERPROCESS_PERMISSIONS_HPP
- #define BOOST_INTERPROCESS_PERMISSIONS_HPP
- #if defined (_MSC_VER) && (_MSC_VER >= 1200)
- # pragma once
- #endif
- #include <boost/interprocess/detail/config_begin.hpp>
- #include <boost/interprocess/detail/workaround.hpp>
- #include <boost/interprocess/interprocess_fwd.hpp>
- #if defined(BOOST_INTERPROCESS_WINDOWS)
- #include <boost/interprocess/detail/win32_api.hpp>
- #endif
- namespace boost {
- namespace interprocess {
- #if defined(BOOST_INTERPROCESS_WINDOWS)
- namespace ipcdetail {
- template <int Dummy>
- struct unrestricted_permissions_holder
- {
- static winapi::interprocess_all_access_security unrestricted;
- };
- template<int Dummy>
- winapi::interprocess_all_access_security unrestricted_permissions_holder<Dummy>::unrestricted;
- }
- #endif
- class permissions
- {
-
- #if defined(BOOST_INTERPROCESS_WINDOWS)
- typedef void* os_permissions_type;
- #else
- typedef int os_permissions_type;
- #endif
- os_permissions_type m_perm;
-
- public:
-
-
- permissions(os_permissions_type type)
- : m_perm(type)
- {}
-
-
-
- permissions()
- { set_default(); }
-
-
-
- void set_default()
- {
-
- #if defined (BOOST_INTERPROCESS_WINDOWS)
- m_perm = 0;
- #else
- m_perm = 0644;
- #endif
-
- }
-
-
- void set_unrestricted()
- {
-
- #if defined (BOOST_INTERPROCESS_WINDOWS)
- m_perm = &ipcdetail::unrestricted_permissions_holder<0>::unrestricted;
- #else
- m_perm = 0666;
- #endif
-
- }
-
-
- void set_permissions(os_permissions_type perm)
- { m_perm = perm; }
-
-
- os_permissions_type get_permissions() const
- { return m_perm; }
- };
- }
- }
- #include <boost/interprocess/detail/config_end.hpp>
- #endif
|