summaryrefslogtreecommitdiff
path: root/boost/interprocess/detail/shared_dir_helpers.hpp
diff options
context:
space:
mode:
authorDongHun Kwak <dh0128.kwak@samsung.com>2017-09-13 11:05:34 +0900
committerDongHun Kwak <dh0128.kwak@samsung.com>2017-09-13 11:06:28 +0900
commit34bd32e225e2a8a94104489b31c42e5801cc1f4a (patch)
treed021b579a0c190354819974e1eaf0baa54b551f3 /boost/interprocess/detail/shared_dir_helpers.hpp
parentf763a99a501650eff2c60288aa6f10ef916d769e (diff)
downloadboost-34bd32e225e2a8a94104489b31c42e5801cc1f4a.tar.gz
boost-34bd32e225e2a8a94104489b31c42e5801cc1f4a.tar.bz2
boost-34bd32e225e2a8a94104489b31c42e5801cc1f4a.zip
Imported Upstream version 1.63.0upstream/1.63.0
Change-Id: Iac85556a04b7e58d63ba636dedb0986e3555714a Signed-off-by: DongHun Kwak <dh0128.kwak@samsung.com>
Diffstat (limited to 'boost/interprocess/detail/shared_dir_helpers.hpp')
-rwxr-xr-x[-rw-r--r--]boost/interprocess/detail/shared_dir_helpers.hpp25
1 files changed, 21 insertions, 4 deletions
diff --git a/boost/interprocess/detail/shared_dir_helpers.hpp b/boost/interprocess/detail/shared_dir_helpers.hpp
index a0ac766f4c..5d4d1b3842 100644..100755
--- a/boost/interprocess/detail/shared_dir_helpers.hpp
+++ b/boost/interprocess/detail/shared_dir_helpers.hpp
@@ -106,9 +106,10 @@ inline void get_shared_dir_root(std::string &dir_path)
{
#if defined (BOOST_INTERPROCESS_WINDOWS)
winapi::get_shared_documents_folder(dir_path);
- #else
+ #else
dir_path = "/tmp";
#endif
+
//We always need this path, so throw on error
if(dir_path.empty()){
error_info err = system_error_code();
@@ -118,11 +119,26 @@ inline void get_shared_dir_root(std::string &dir_path)
dir_path += "/boost_interprocess";
}
+#if defined(BOOST_INTERPROCESS_SHARED_DIR_FUNC) && defined(BOOST_INTERPROCESS_SHARED_DIR_PATH)
+#error "Error: Both BOOST_INTERPROCESS_SHARED_DIR_FUNC and BOOST_INTERPROCESS_SHARED_DIR_PATH defined!"
+#endif
+
+#ifdef BOOST_INTERPROCESS_SHARED_DIR_FUNC
+namespace boost {
+ namespace interprocess {
+ namespace ipcdetail {
+ // When BOOST_INTERPROCESS_SHARED_DIR_FUNC is defined, users have to implement
+ // get_shared_dir
+ void get_shared_dir(std::string &shared_dir);
+ }
+ }
+}
+#else
inline void get_shared_dir(std::string &shared_dir)
{
#if defined(BOOST_INTERPROCESS_SHARED_DIR_PATH)
shared_dir = BOOST_INTERPROCESS_SHARED_DIR_PATH;
- #else
+ #else
get_shared_dir_root(shared_dir);
#if defined(BOOST_INTERPROCESS_HAS_KERNEL_BOOTTIME)
shared_dir += "/";
@@ -130,6 +146,7 @@ inline void get_shared_dir(std::string &shared_dir)
#endif
#endif
}
+#endif
inline void shared_filepath(const char *filename, std::string &filepath)
{
@@ -140,8 +157,8 @@ inline void shared_filepath(const char *filename, std::string &filepath)
inline void create_shared_dir_and_clean_old(std::string &shared_dir)
{
- #if defined(BOOST_INTERPROCESS_SHARED_DIR_PATH)
- shared_dir = BOOST_INTERPROCESS_SHARED_DIR_PATH;
+ #if defined(BOOST_INTERPROCESS_SHARED_DIR_PATH) || defined(BOOST_INTERPROCESS_SHARED_DIR_FUNC)
+ get_shared_dir(shared_dir);
#else
//First get the temp directory
std::string root_shared_dir;