From 9ca95591ffd29da495c0a72e38f010f0078f098b Mon Sep 17 00:00:00 2001 From: Jason Volk Date: Wed, 15 Sep 2021 02:28:22 -0700 Subject: [PATCH] ircd::gpt::model: Improve cache open mode related. --- ircd/gpt_model.cc | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/ircd/gpt_model.cc b/ircd/gpt_model.cc index 3644b13b1..9042022e5 100644 --- a/ircd/gpt_model.cc +++ b/ircd/gpt_model.cc @@ -185,14 +185,21 @@ ircd::gpt::model::init_from_cache(const string_view &cache_path) sizeof(model::decoder), }; + const auto mode + { + cache_shared? + std::ios::in | std::ios::out: + std::ios::in + }; + const fs::fd fd { - cache_path, std::ios::in //| std::ios::out + cache_path, mode }; fs::map::opts map_opts { - std::ios::in | std::ios::out + mode }; map_opts.locked = bool(cache_locked);