diff --git a/doc/interprocess.qbk b/doc/interprocess.qbk index 86b72be..c444b0b 100644 --- a/doc/interprocess.qbk +++ b/doc/interprocess.qbk @@ -6629,22 +6629,41 @@ want [*Boost.Interprocess] to initialize the COM library with another model, def [section:notes_windows_shm_folder Shared memory emulation folder] Shared memory (`shared_memory_object`) is implemented in windows using memory mapped files, placed in a -directory in the shared documents folder (`SOFTWARE\Microsoft\Windows\CurrentVersion\Explorer\Shell Folders\Common AppData`). -This directory name is the last bootup time (obtained via COM calls), so that each bootup shared memory is created in a new +shared directory in the shared documents folder (`SOFTWARE\Microsoft\Windows\CurrentVersion\Explorer\Shell Folders\Common AppData`). +This directory name is the last bootup time obtained via COM calls (if `BOOST_INTERPROCESS_BOOTSTAMP_IS_LASTBOOTUPTIME`) defined +or searching the system log for a startup event (the default implementation), so that each bootup shared memory is created in a new folder obtaining kernel persistence shared memory. -Unfortunately, due to COM implementation related errors, in Boost 1.48 & Boost 1.49 the bootup-time folder was dumped and files +If using `BOOST_INTERPROCESS_BOOTSTAMP_IS_LASTBOOTUPTIME`, due to COM implementation related errors, +in Boost 1.48 & Boost 1.49 the bootup-time folder was dumped and files were directly created in shared documents folder, reverting to filesystem persistence shared memory. Boost 1.50 fixed those issues and recovered bootup time directory and kernel persistence. If you need to reproduce Boost 1.48 & Boost 1.49 behaviour to communicate with applications compiled with that version, comment `#define BOOST_INTERPROCESS_HAS_KERNEL_BOOTTIME` directive in the Windows configuration part of `boost/interprocess/detail/workaround.hpp`. +If using the default implementation, (`BOOST_INTERPROCESS_BOOTSTAMP_IS_LASTBOOTUPTIME` undefined) and the Startup Event is not +found, this might be due to some buggy software that floods or erases the event log. + +In any error case (shared documents folder is not defined or bootup time could not be obtained, the library throws an error. You still +can use [*Boost.Interprocess] definining your own directory as the shared directory. Just define `BOOST_INTERPROCESS_SHARED_DIR_PATH` +when using the library and that path will be used to place shared memory files. + [endsect] [endsect] [section:notes_linux Notes for Linux users] +[section:notes_linux_shm_folder Shared memory emulation folder] + +On systems without POSIX shared memory support shared memory objects are implemented as memory mapped files, using a directory +placed in "/tmp" that can include (if `BOOST_INTERPROCESS_HAS_KERNEL_BOOTTIME` is defined) the last bootup time (if the Os supports it). +As in Windows, in any error case obtaining this directory the library throws an error . You still can use +[*Boost.Interprocess] definining your own directory as the shared directory. Just define `BOOST_INTERPROCESS_SHARED_DIR_PATH` +when using the library and that path will be used to place shared memory files. + +[endsect] + [section:notes_linux_overcommit Overcommit] The committed address space is the total amount of virtual memory (swap or physical memory/RAM) that the kernel might have to supply @@ -6720,8 +6739,10 @@ thank them: * [@https://svn.boost.org/trac/boost/ticket/9284 #9284 (['"WaitForSingleObject(mutex) must handle WAIT_ABANDONED"])]. * [@https://svn.boost.org/trac/boost/ticket/9285 #9285 (['"CreateMutex returns NULL if fails"])]. * [@https://svn.boost.org/trac/boost/ticket/9288 #9288 (['"timed_wait does not check if it has expired"])]. - * [@https://svn.boost.org/trac/boost/ticket/9408 #9408: ['"Android does not support XSI_SHARED_MEMORY_OBJECTS"]]. + * [@https://svn.boost.org/trac/boost/ticket/9408 #9408 (['"Android does not support XSI_SHARED_MEMORY_OBJECTS"]]). + * [@https://svn.boost.org/trac/boost/ticket/9767 #9767 (['"bootstamp generation causes error in case of corrupt Windows Event Log"])]. * [@https://svn.boost.org/trac/boost/ticket/9835 #9835 (['"Boost Interprocess fails to compile with Android NDK GCC 4.8, -Werror=unused-variable"])]. + * [@https://svn.boost.org/trac/boost/ticket/9911 #9911 (['"get_tmp_base_dir(...) failure"])]. * [@https://svn.boost.org/trac/boost/ticket/9946 #9946 (['"ret_ptr uninitialized in init_atomic_func, fini_atomic_func"])]. * [*ABI breaking]: [@https://svn.boost.org/trac/boost/ticket/9221 #9221] showed @@ -6729,19 +6750,26 @@ thank them: was completely broken so an ABI break was necessary to have a working implementation. * Simplified, refactored and unified (timed_)lock code based on try_lock(). - There were several bugs in when handling timeout expirations. + There were several bugs when handling timeout expirations. + +* Changed the implementation of condition variables' destructors to allow POSIX semantics + (the condition variable can be destroyed after all waiting threads have been woken up).. + +* Added `BOOST_INTERPROCESS_SHARED_DIR_PATH` option to define the shared directory used to place shared memory objects + when implemented as memory mapped files. [endsect] [section:release_notes_boost_1_55_00 Boost 1.55 Release] -* Fixed bugs [@https://svn.boost.org/trac/boost/ticket/7156 #7156], - [@https://svn.boost.org/trac/boost/ticket/7164 #7164], - [@https://svn.boost.org/trac/boost/ticket/8277 #8277], - [@https://svn.boost.org/trac/boost/ticket/8976 #8976], - [@https://svn.boost.org/trac/boost/ticket/9065 #9065], - [@https://svn.boost.org/trac/boost/ticket/9073 #9073], - [@https://svn.boost.org/trac/boost/ticket/9008 #9008]. +* Fixed bugs [@https://svn.boost.org/trac/boost/ticket/7156 #7156] (['"interprocess buffer streams leak memory on construction"]]). + [@https://svn.boost.org/trac/boost/ticket/7164 #7164] (['"Two potential bugs with b::int::vector of b::i::weak_ptr"]]). + [@https://svn.boost.org/trac/boost/ticket/7860 #7860] (['"smart_ptr's yield_k and spinlock utilities can improve spinlock-based sychronization primitives"]]). + [@https://svn.boost.org/trac/boost/ticket/8277 #8277] (['"docs for named_mutex erroneously refer to interprocess_mutex"]]). + [@https://svn.boost.org/trac/boost/ticket/8976 #8976] (['"shared_ptr fails to compile if used with a scoped_allocator"]]). + [@https://svn.boost.org/trac/boost/ticket/9008 #9008] (['"conditions variables fast enough only when opening a multiprocess browser"]]). + [@https://svn.boost.org/trac/boost/ticket/9065 #9065] (['"atomic_cas32 inline assembly wrong on ppc32"]]). + [@https://svn.boost.org/trac/boost/ticket/9073 #9073] (['"Conflict names 'realloc'"]]). [endsect] diff --git a/include/boost/interprocess/detail/file_locking_helpers.hpp b/include/boost/interprocess/detail/file_locking_helpers.hpp index a6d0af6..6a7ce8e 100644 --- a/include/boost/interprocess/detail/file_locking_helpers.hpp +++ b/include/boost/interprocess/detail/file_locking_helpers.hpp @@ -26,7 +26,7 @@ #include #include -#include +#include #if defined(BOOST_INTERPROCESS_WINDOWS) diff --git a/include/boost/interprocess/detail/os_file_functions.hpp b/include/boost/interprocess/detail/os_file_functions.hpp index 7b7d9b6..de1b3ef 100644 --- a/include/boost/interprocess/detail/os_file_functions.hpp +++ b/include/boost/interprocess/detail/os_file_functions.hpp @@ -94,9 +94,22 @@ inline file_handle_t file_handle_from_mapping_handle(mapping_handle_t hnd) inline bool create_directory(const char *path) { return winapi::create_directory(path); } -inline const char *get_temporary_path() -{ return std::getenv("TMP"); } - +inline bool get_temporary_path(char *buffer, std::size_t buf_len, std::size_t &required_len) +{ + required_len = 0; + //std::size_t is always bigger or equal than unsigned long in Windows systems + //In case std::size_t is bigger than unsigned long + unsigned long buf = buf_len; + if(buf_len != buf){ //maybe overflowed + return false; + } + required_len = winapi::get_temp_path(buf_len, buffer); + const bool ret = !(buf_len < required_len); + if(ret && buffer[required_len-1] == '\\'){ + buffer[required_len-1] = 0; + } + return ret; +} inline file_handle_t create_new_file (const char *name, mode_t mode, const permissions & perm = permissions(), bool temporary = false) @@ -400,17 +413,15 @@ inline file_handle_t file_handle_from_mapping_handle(mapping_handle_t hnd) inline bool create_directory(const char *path) { return ::mkdir(path, 0777) == 0 && ::chmod(path, 0777) == 0; } -inline const char *get_temporary_path() +inline bool get_temporary_path(char *buffer, std::size_t buf_len, std::size_t &required_len) { - const char *names[] = {"/tmp", "TMPDIR", "TMP", "TEMP" }; - const int names_size = sizeof(names)/sizeof(names[0]); - struct stat data; - for(int i = 0; i != names_size; ++i){ - if(::stat(names[i], &data) == 0){ - return names[i]; - } + required_len = 5u; + if(buf_len < required_len) + return false; + else{ + std::strcpy(buffer, "/tmp"); } - return "/tmp"; + return true; } inline file_handle_t create_new_file @@ -694,6 +705,18 @@ inline bool open_or_create_directory(const char *dir_name) return true; } +inline std::string get_temporary_path() +{ + std::size_t required_len = 0; + get_temporary_path(0, 0, required_len); + std::string ret_str(required_len, char(0)); + get_temporary_path(&ret_str[0], ret_str.size(), required_len); + while(!ret_str.empty() && !ret_str[ret_str.size()-1]){ + ret_str.erase(ret_str.size()-1); + } + + return ret_str; +} } //namespace ipcdetail{ } //namespace interprocess { diff --git a/include/boost/interprocess/detail/portable_intermodule_singleton.hpp b/include/boost/interprocess/detail/portable_intermodule_singleton.hpp index 15388bc..3c8c10e 100644 --- a/include/boost/interprocess/detail/portable_intermodule_singleton.hpp +++ b/include/boost/interprocess/detail/portable_intermodule_singleton.hpp @@ -23,7 +23,7 @@ #include #include #include -#include +#include #include #include #include @@ -45,7 +45,7 @@ static void create_tmp_subdir_and_get_pid_based_filepath { //Let's create a lock file for each process gmem that will mark if //the process is alive or not - create_tmp_and_clean_old(s); + create_shared_dir_and_clean_old(s); s += "/"; s += subdir_name; if(!open_or_create_directory(s.c_str())){ @@ -187,7 +187,7 @@ struct thread_safe_global_map_dependant static bool remove_old_gmem() { std::string refcstrRootDirectory; - tmp_folder(refcstrRootDirectory); + get_shared_dir(refcstrRootDirectory); refcstrRootDirectory += "/"; refcstrRootDirectory += get_lock_file_subdir_name(); return for_each_file_in_dir(refcstrRootDirectory.c_str(), apply_gmem_erase_logic); diff --git a/include/boost/interprocess/detail/robust_emulation.hpp b/include/boost/interprocess/detail/robust_emulation.hpp index 59bfc29..f47b4ae 100644 --- a/include/boost/interprocess/detail/robust_emulation.hpp +++ b/include/boost/interprocess/detail/robust_emulation.hpp @@ -21,7 +21,7 @@ #include #include #include -#include +#include #include #include #include @@ -63,7 +63,7 @@ inline const char *robust_lock_prefix() inline void robust_lock_path(std::string &s) { - tmp_folder(s); + get_shared_dir(s); s += "/"; s += robust_lock_subdir_path(); } diff --git a/include/boost/interprocess/detail/tmp_dir_helpers.hpp b/include/boost/interprocess/detail/shared_dir_helpers.hpp similarity index 61% rename from include/boost/interprocess/detail/tmp_dir_helpers.hpp rename to include/boost/interprocess/detail/shared_dir_helpers.hpp index 2af1a8a..e3a4065 100644 --- a/include/boost/interprocess/detail/tmp_dir_helpers.hpp +++ b/include/boost/interprocess/detail/shared_dir_helpers.hpp @@ -1,6 +1,6 @@ ////////////////////////////////////////////////////////////////////////////// // -// (C) Copyright Ion Gaztanaga 2007-2012. Distributed under the Boost +// (C) Copyright Ion Gaztanaga 2007-2014. Distributed under the Boost // Software License, Version 1.0. (See accompanying file // LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) // @@ -8,8 +8,8 @@ // ////////////////////////////////////////////////////////////////////////////// -#ifndef BOOST_INTERPROCESS_DETAIL_TMP_DIR_HELPERS_HPP -#define BOOST_INTERPROCESS_DETAIL_TMP_DIR_HELPERS_HPP +#ifndef BOOST_INTERPROCESS_DETAIL_SHARED_DIR_HELPERS_HPP +#define BOOST_INTERPROCESS_DETAIL_SHARED_DIR_HELPERS_HPP #include #include @@ -33,7 +33,11 @@ namespace ipcdetail { { windows_bootstamp() { - winapi::get_last_bootup_time(stamp); + //Throw if bootstamp not available + if(!winapi::get_last_bootup_time(stamp)){ + error_info err = system_error_code(); + throw interprocess_exception(err); + } } //Use std::string. Even if this will be constructed in shared memory, all //modules/dlls are from this process so internal raw pointers to heap are always valid @@ -90,78 +94,84 @@ namespace ipcdetail { #endif #endif //#if defined(BOOST_INTERPROCESS_HAS_KERNEL_BOOTTIME) -inline void get_tmp_base_dir(std::string &tmp_name) +inline void get_shared_dir_root(std::string &dir_path) { #if defined (BOOST_INTERPROCESS_WINDOWS) - winapi::get_shared_documents_folder(tmp_name); - if(tmp_name.empty() || !winapi::is_directory(tmp_name.c_str())){ - tmp_name = get_temporary_path(); - } + winapi::get_shared_documents_folder(dir_path); #else - tmp_name = get_temporary_path(); + dir_path = "/tmp"; #endif - if(tmp_name.empty()){ + //We always need this path, so throw on error + if(dir_path.empty()){ error_info err = system_error_code(); throw interprocess_exception(err); } //Remove final null. - tmp_name += "/boost_interprocess"; + dir_path += "/boost_interprocess"; } -inline void tmp_folder(std::string &tmp_name) +inline void get_shared_dir(std::string &shared_dir) { - get_tmp_base_dir(tmp_name); - #if defined(BOOST_INTERPROCESS_HAS_KERNEL_BOOTTIME) - tmp_name += "/"; - get_bootstamp(tmp_name, true); + #if defined(BOOST_INTERPROCESS_SHARED_DIR_PATH) + shared_dir = BOOST_INTERPROCESS_SHARED_DIR_PATH; + #else + get_shared_dir_root(shared_dir); + #if defined(BOOST_INTERPROCESS_HAS_KERNEL_BOOTTIME) + shared_dir += "/"; + get_bootstamp(shared_dir, true); + #endif #endif } -inline void tmp_filename(const char *filename, std::string &tmp_name) +inline void shared_filepath(const char *filename, std::string &filepath) { - tmp_folder(tmp_name); - tmp_name += "/"; - tmp_name += filename; + get_shared_dir(filepath); + filepath += "/"; + filepath += filename; } -inline void create_tmp_and_clean_old(std::string &tmp_name) +inline void create_shared_dir_and_clean_old(std::string &shared_dir) { - //First get the temp directory - std::string root_tmp_name; - get_tmp_base_dir(root_tmp_name); - - //If fails, check that it's because already exists - if(!create_directory(root_tmp_name.c_str())){ - error_info info(system_error_code()); - if(info.get_error_code() != already_exists_error){ - throw interprocess_exception(info); - } - } - - #if defined(BOOST_INTERPROCESS_HAS_KERNEL_BOOTTIME) - tmp_folder(tmp_name); + #if defined(BOOST_INTERPROCESS_SHARED_DIR_PATH) + shared_dir = BOOST_INTERPROCESS_SHARED_DIR_PATH; + #else + //First get the temp directory + std::string root_shared_dir; + get_shared_dir_root(root_shared_dir); //If fails, check that it's because already exists - if(!create_directory(tmp_name.c_str())){ + if(!create_directory(root_shared_dir.c_str())){ error_info info(system_error_code()); if(info.get_error_code() != already_exists_error){ throw interprocess_exception(info); } } - //Now erase all old directories created in the previous boot sessions - std::string subdir = tmp_name; - subdir.erase(0, root_tmp_name.size()+1); - delete_subdirectories(root_tmp_name, subdir.c_str()); - #else - tmp_name = root_tmp_name; + + #if defined(BOOST_INTERPROCESS_HAS_KERNEL_BOOTTIME) + get_shared_dir(shared_dir); + + //If fails, check that it's because already exists + if(!create_directory(shared_dir.c_str())){ + error_info info(system_error_code()); + if(info.get_error_code() != already_exists_error){ + throw interprocess_exception(info); + } + } + //Now erase all old directories created in the previous boot sessions + std::string subdir = shared_dir; + subdir.erase(0, root_shared_dir.size()+1); + delete_subdirectories(root_shared_dir, subdir.c_str()); + #else + shared_dir = root_shared_dir; + #endif #endif } -inline void create_tmp_and_clean_old_and_get_filename(const char *filename, std::string &tmp_name) +inline void create_shared_dir_cleaning_old_and_get_filepath(const char *filename, std::string &shared_dir) { - create_tmp_and_clean_old(tmp_name); - tmp_name += "/"; - tmp_name += filename; + create_shared_dir_and_clean_old(shared_dir); + shared_dir += "/"; + shared_dir += filename; } inline void add_leading_slash(const char *name, std::string &new_name) @@ -178,4 +188,4 @@ inline void add_leading_slash(const char *name, std::string &new_name) #include -#endif //ifndef BOOST_INTERPROCESS_DETAIL_TMP_DIR_HELPERS_HPP +#endif //ifndef BOOST_INTERPROCESS_DETAIL_SHARED_DIR_HELPERS_HPP diff --git a/include/boost/interprocess/detail/win32_api.hpp b/include/boost/interprocess/detail/win32_api.hpp index cf0b2da..36aaa6f 100644 --- a/include/boost/interprocess/detail/win32_api.hpp +++ b/include/boost/interprocess/detail/win32_api.hpp @@ -985,6 +985,8 @@ extern "C" __declspec(dllimport) long __stdcall VariantClear(wchar_variant * pva extern "C" __declspec(dllimport) int __stdcall SHGetSpecialFolderPathA (void* hwnd, const char *pszPath, int csidl, int fCreate); +extern "C" __declspec(dllimport) int __stdcall SHGetFolderPathA(void *hwnd, int csidl, void *hToken, unsigned long dwFlags, const char *pszPath); + //EventLog access functions static const unsigned long eventlog_sequential_read = 0x0001; @@ -1793,12 +1795,16 @@ inline void get_shared_documents_folder(std::string &s) } } #else //registry alternative: SHGetSpecialFolderPathA - const int IG_CSIDL_COMMON_APPDATA = 0x0023; // All Users\Application Data + const int IG_CSIDL_COMMON_APPDATA = 0x0023; // All Users\Application Data + const int IG_CSIDL_FLAG_CREATE = 0x8000; // new for Win2K, or this in to force creation of folder + const int IG_SHGFP_TYPE_CURRENT = 0; // current value for user, verify it exists + s.clear(); char szPath[max_path]; - if(SHGetSpecialFolderPathA(0, szPath, IG_CSIDL_COMMON_APPDATA, 1)) { + if(0 == SHGetFolderPathA(0, IG_CSIDL_COMMON_APPDATA | IG_CSIDL_FLAG_CREATE, 0, IG_SHGFP_TYPE_CURRENT, szPath)){ s = szPath; } + #endif } diff --git a/include/boost/interprocess/detail/xsi_shared_memory_device.hpp b/include/boost/interprocess/detail/xsi_shared_memory_device.hpp index b2a2750..47785b8 100644 --- a/include/boost/interprocess/detail/xsi_shared_memory_device.hpp +++ b/include/boost/interprocess/detail/xsi_shared_memory_device.hpp @@ -23,7 +23,7 @@ #include #include #include -#include +#include #include #include @@ -197,7 +197,7 @@ inline void xsi_shared_memory_device::priv_obtain_index permissions p; p.set_unrestricted(); std::string xsi_shm_emulation_file_path; - ipcdetail::create_tmp_and_clean_old_and_get_filename(filename, xsi_shm_emulation_file_path); + ipcdetail::create_shared_dir_cleaning_old_and_get_filepath(filename, xsi_shm_emulation_file_path); ipcdetail::create_or_open_file(xsi_shm_emulation_file_path.c_str(), read_write, p); const std::size_t MemSize = sizeof(info_t); diff --git a/include/boost/interprocess/detail/xsi_shared_memory_file_wrapper.hpp b/include/boost/interprocess/detail/xsi_shared_memory_file_wrapper.hpp index 51af830..24e159c 100644 --- a/include/boost/interprocess/detail/xsi_shared_memory_file_wrapper.hpp +++ b/include/boost/interprocess/detail/xsi_shared_memory_file_wrapper.hpp @@ -23,7 +23,7 @@ #include #include #include -#include +#include #include #include diff --git a/include/boost/interprocess/shared_memory_object.hpp b/include/boost/interprocess/shared_memory_object.hpp index 54563f5..9442dd9 100644 --- a/include/boost/interprocess/shared_memory_object.hpp +++ b/include/boost/interprocess/shared_memory_object.hpp @@ -19,7 +19,7 @@ #include #include #include -#include +#include #include #include #include @@ -180,7 +180,7 @@ inline bool shared_memory_object::priv_open_or_create { m_filename = filename; std::string shmfile; - ipcdetail::create_tmp_and_clean_old_and_get_filename(filename, shmfile); + ipcdetail::create_shared_dir_cleaning_old_and_get_filepath(filename, shmfile); //Set accesses if (mode != read_write && mode != read_only){ @@ -221,7 +221,7 @@ inline bool shared_memory_object::remove(const char *filename) try{ //Make sure a temporary path is created for shared memory std::string shmfile; - ipcdetail::tmp_filename(filename, shmfile); + ipcdetail::shared_filepath(filename, shmfile); return ipcdetail::delete_file(shmfile.c_str()); } catch(...){ @@ -285,7 +285,7 @@ inline bool shared_memory_object::priv_open_or_create ipcdetail::add_leading_slash(filename, m_filename); } else{ - ipcdetail::create_tmp_and_clean_old_and_get_filename(filename, m_filename); + ipcdetail::create_shared_dir_cleaning_old_and_get_filepath(filename, m_filename); } //Create new mapping @@ -365,7 +365,7 @@ inline bool shared_memory_object::priv_open_or_create inline bool shared_memory_object::remove(const char *filename) { try{ - std::string file_str; + std::string filepath; #if defined(BOOST_INTERPROCESS_FILESYSTEM_BASED_POSIX_SHARED_MEMORY) const bool add_leading_slash = false; #elif defined(BOOST_INTERPROCESS_RUNTIME_FILESYSTEM_BASED_POSIX_SHARED_MEMORY) @@ -374,12 +374,12 @@ inline bool shared_memory_object::remove(const char *filename) const bool add_leading_slash = true; #endif if(add_leading_slash){ - ipcdetail::add_leading_slash(filename, file_str); + ipcdetail::add_leading_slash(filename, filepath); } else{ - ipcdetail::tmp_filename(filename, file_str); + ipcdetail::shared_filepath(filename, filepath); } - return 0 == shm_unlink(file_str.c_str()); + return 0 == shm_unlink(filepath.c_str()); } catch(...){ return false; diff --git a/include/boost/interprocess/sync/posix/semaphore_wrapper.hpp b/include/boost/interprocess/sync/posix/semaphore_wrapper.hpp index 6d94a02..eacbbc0 100644 --- a/include/boost/interprocess/sync/posix/semaphore_wrapper.hpp +++ b/include/boost/interprocess/sync/posix/semaphore_wrapper.hpp @@ -15,7 +15,7 @@ #include #include #include -#include +#include #include #include //O_CREAT, O_*... @@ -51,7 +51,7 @@ inline bool semaphore_open #ifndef BOOST_INTERPROCESS_FILESYSTEM_BASED_POSIX_SEMAPHORES add_leading_slash(origname, name); #else - create_tmp_and_clean_old_and_get_filename(origname, name); + create_shared_dir_cleaning_old_and_get_filepath(origname, name); #endif //Create new mapping @@ -117,7 +117,7 @@ inline bool semaphore_unlink(const char *semname) #ifndef BOOST_INTERPROCESS_FILESYSTEM_BASED_POSIX_SEMAPHORES add_leading_slash(semname, sem_str); #else - tmp_filename(semname, sem_str); + shared_filepath(semname, sem_str); #endif return 0 == sem_unlink(sem_str.c_str()); } diff --git a/include/boost/interprocess/sync/windows/named_sync.hpp b/include/boost/interprocess/sync/windows/named_sync.hpp index a15a0be..4046413 100644 --- a/include/boost/interprocess/sync/windows/named_sync.hpp +++ b/include/boost/interprocess/sync/windows/named_sync.hpp @@ -19,7 +19,7 @@ #include #include #include -#include +#include #include #include #include @@ -106,7 +106,7 @@ inline void windows_named_sync::open_or_create //Use a file to emulate POSIX lifetime semantics. After this logic //we'll obtain the ID of the native handle to open in aux_str { - create_tmp_and_clean_old_and_get_filename(name, aux_str); + create_shared_dir_cleaning_old_and_get_filepath(name, aux_str); //Create a file with required permissions. m_file_hnd = winapi::create_file ( aux_str.c_str() @@ -198,7 +198,7 @@ inline bool windows_named_sync::remove(const char *name) try{ //Make sure a temporary path is created for shared memory std::string semfile; - ipcdetail::tmp_filename(name, semfile); + ipcdetail::shared_filepath(name, semfile); return winapi::unlink_file(semfile.c_str()); } catch(...){ diff --git a/proj/vc7ide/interprocesslib.vcproj b/proj/vc7ide/interprocesslib.vcproj index 75ac484..8440fd5 100644 --- a/proj/vc7ide/interprocesslib.vcproj +++ b/proj/vc7ide/interprocesslib.vcproj @@ -575,7 +575,7 @@ RelativePath="..\..\..\..\boost\interprocess\detail\segment_manager_helper.hpp"> + RelativePath="..\..\..\..\boost\interprocess\detail\shared_dir_helpers.hpp">