Opened 8 years ago
Last modified 5 years ago
#10644 new Feature Requests
BOOST_IPC_SHARED_DIR env variable to be used for get_shared_dir()
Reported by: | Owned by: | Ion Gaztañaga | |
---|---|---|---|
Milestone: | Boost 1.57.0 | Component: | interprocess |
Version: | Boost 1.57.0 | Severity: | Problem |
Keywords: | Cc: |
Description
Hi,
Will it be possible to have shared_dir not hardcoded? Currently it is determine by some tricks (some involve event log parsing on windows, which fails a lot). The only practical solution for us was to use BOOST_INTERPROCESS_SHARED_DIR_PATH define.
boost/interprocess/detail/shared_dir_helpers.hpp
inline void get_shared_dir(std::string &shared_dir) {
#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
}
That has limitations tough as it makes it very difficult to test software in isolation (it requires access to the same folder). Similarly it makes is difficult to run program of machines with different file structure.
Can it be configurable by some environment variable ?
Ion Gaztañaga :
This seems a good idea. I guess we won't support changing the value of the variable while the program is running, right? For performance reasons, I guess we could just cache the value the first time we access to the environment variable (or maybe in program startup).
"BOOST_INTERPROCESS_SHARED_DIR_PATH" is too long for that environment variable name?
BOOST_IPC_SHARED_DIR is good name for env variable It should be read just at the start of the process (no need to change it during running of the program)
thanks a lot!
Yes, an environment variable would probably be a good work-around for this:
https://stackoverflow.com/questions/39742630/boost-shared-memory-cant-be-initialized?noredirect=1&lq=1
https://svn.boost.org/trac10/ticket/12137