213 fair::Logger::SetConsoleColor(
true);
221 bool checkPresence =
true;
223 uint64_t refcount_segment_size = 0;
225 vector<string> regions;
227 options_description desc(
"Options");
230 "segments",
value<vector<string>>(&
segments)->multitoken()->composing(),
"Segments, as <id>,<size>,<numaid> <id>,<size>,<numaid> <id>,<size>,<numaid> ... (numaid: -2 disabled, -1 interleave, >=0 node)")(
231 "regions",
value<vector<string>>(®ions)->multitoken()->composing(),
"Regions, as <id>,<size> <id>,<size>,<numaid> <id>,<size>,<numaid> ...")(
232 "nozero",
value<bool>(&nozero)->default_value(
false)->implicit_value(
true),
"Do not zero segments after initialization")(
233 "check-presence",
value<bool>(&checkPresence)->default_value(
true)->implicit_value(
true),
"Check periodically if configured segments/regions are still present, and cleanup and leave if they are not")(
234 "refcount-segment-size",
value<uint64_t>(&refcount_segment_size)->default_value(1),
"Size in bytes of refCount segment (global setting affecting all unmanaged regions, 1 = use default, 0 = disable rc segment)")(
235 "help,h",
"Print help");
238 store(parse_command_line(argc, argv, desc), vm);
240 if (vm.count(
"help")) {
241 LOG(info) <<
"ShmManager"
251 std::thread resetContentThread([&shmManager]() {
253 std::this_thread::sleep_for(std::chrono::milliseconds(50));
254 if (gResetContent == 1) {
255 LOG(info) <<
"Resetting content for shmId " << shmManager.
shmId;
258 LOG(info) <<
"Done resetting content for shmId " << shmManager.
shmId;
266 LOG(error) <<
"Failed to find segments, exiting.";
269 std::this_thread::sleep_for(std::chrono::milliseconds(500));
273 if (resetContentThread.joinable()) {
274 resetContentThread.join();
277 LOG(info) <<
"stopping.";
278 }
catch (exception& e) {
279 LOG(error) <<
"Exception reached the top of main: " << e.what() <<
", exiting";