File indexing completed on 2026-09-10 08:49:24
0001
0002
0003
0004
0005
0006
0007
0008
0009
0010
0011 #ifndef BOOST_INTERPROCESS_XSI_KEY_HPP
0012 #define BOOST_INTERPROCESS_XSI_KEY_HPP
0013
0014 #ifndef BOOST_CONFIG_HPP
0015 # include <boost/config.hpp>
0016 #endif
0017 0018 ">#
0019 #if defined(BOOST_HAS_PRAGMA_ONCE)
0020 # pragma once
0021 #endif
0022
0023 #include <boost/interprocess/detail/config_begin.hpp>
0024 #include <boost/interprocess/detail/workaround.hpp>
0025 #include <boost/detail/workaround.hpp>
0026
0027 #if !defined(BOOST_INTERPROCESS_XSI_SHARED_MEMORY_OBJECTS)
0028 #error "This header can't be used in operating systems without XSI (System V) shared memory support"
0029 #endif
0030
0031 #include <boost/interprocess/creation_tags.hpp>
0032 #include <boost/interprocess/exceptions.hpp>
0033 #include <boost/interprocess/detail/utilities.hpp>
0034 #include <boost/move/utility_core.hpp>
0035 #include <boost/interprocess/detail/os_file_functions.hpp>
0036 #include <boost/interprocess/interprocess_fwd.hpp>
0037 #include <boost/interprocess/exceptions.hpp>
0038 #include <sys/types.h>
0039 #include <sys/ipc.h>
0040 #include <cstddef>
0041 #include <boost/cstdint.hpp>
0042
0043
0044
0045
0046 namespace boost {
0047 namespace interprocess {
0048
0049
0050
0051
0052
0053 class xsi_key
0054 {
0055 public:
0056
0057
0058
0059 xsi_key()
0060 : m_key(IPC_PRIVATE)
0061 {}
0062
0063
0064 explicit xsi_key(key_t key)
0065 : m_key(key)
0066 {}
0067
0068
0069
0070
0071 xsi_key(const char *path, boost::uint8_t id)
0072 {
0073 key_t key;
0074 if(path){
0075 key = ::ftok(path, id);
0076 if(((key_t)-1) == key){
0077 error_info err = system_error_code();
0078 throw interprocess_exception(err);
0079 }
0080 }
0081 else{
0082 key = IPC_PRIVATE;
0083 }
0084 m_key = key;
0085 }
0086
0087
0088 key_t get_key() const
0089 { return m_key; }
0090
0091 #if !defined(BOOST_INTERPROCESS_DOXYGEN_INVOKED)
0092 private:
0093 key_t m_key;
0094 #endif
0095 };
0096
0097 }
0098 }
0099
0100 #include <boost/interprocess/detail/config_end.hpp>
0101
0102 #endif