online.git: 2 commits - common/Log-poco.cpp common/Util.cpp common/Util.hpp kit/ForKit.cpp kit/Kit.cpp kit/KitWebSocket.cpp test/ClientTestStubs.cpp wsd/Admin.cpp wsd/COOLWSD.cpp wsd/coolwsd-fork.cpp wsd/COOLWSD.hpp wsd/coolwsd-inproc.cpp

0 views
Skip to first unread message

"Areg Nakashian (via cogerrit)"

unread,
5:21 AM (1 hour ago) 5:21 AM
to collaboraon...@googlegroups.com
common/Log-poco.cpp | 3 ++-
common/Util.cpp | 3 ---
common/Util.hpp | 1 -
kit/ForKit.cpp | 10 +++++-----
kit/Kit.cpp | 8 ++++----
kit/KitWebSocket.cpp | 2 +-
test/ClientTestStubs.cpp | 2 --
wsd/Admin.cpp | 2 +-
wsd/COOLWSD.cpp | 21 ++++++++++-----------
wsd/COOLWSD.hpp | 2 --
wsd/coolwsd-fork.cpp | 2 --
wsd/coolwsd-inproc.cpp | 2 --
12 files changed, 23 insertions(+), 35 deletions(-)

New commits:
commit b44b74e01546e48e25523e78eaeafd03248d60f5
Author: Areg Nakashian <areg.na...@gmail.com>
AuthorDate: Sun Apr 26 15:02:09 2026 -0400
Commit: Ashod Nakashian <ashod.n...@collabora.co.uk>
CommitDate: Wed Apr 29 09:20:52 2026 +0000

common: kit: wsd: make conditionals on isKitInProcess constexpr

Signed-off-by: Areg Nakashian <areg.na...@gmail.com>
Change-Id: I303524d9c2b4b12fba06e3bbbd64eb052f45dbdd
Reviewed-on: https://gerrit.collaboraoffice.com/c/online/+/1695
Reviewed-by: Ashod Nakashian <ashod.n...@collabora.co.uk>
Tested-by: Jenkins CPCI <rel...@collaboraoffice.com>

diff --git a/common/Log-poco.cpp b/common/Log-poco.cpp
index 1572cf563915..7e92d7b76e9f 100644
--- a/common/Log-poco.cpp
+++ b/common/Log-poco.cpp
@@ -594,7 +594,8 @@ namespace Log
{
if constexpr (Util::isMobileApp())
return;
- if (!Util::isKitInProcess())
+
+ if constexpr (!Util::isKitInProcess())
{
// Allow other threads time to exit.
for (int i = 0; i < 10 && ThreadLocalBufferCount > 1; ++i)
diff --git a/kit/ForKit.cpp b/kit/ForKit.cpp
index 2425fe9a7fde..661d8c2b7287 100644
--- a/kit/ForKit.cpp
+++ b/kit/ForKit.cpp
@@ -309,7 +309,7 @@ bool haveCorrectCapabilities()
/// Check if some previously forked kids have died.
void cleanupChildren(const std::string& childRoot)
{
- if (Util::isKitInProcess())
+ if constexpr (Util::isKitInProcess())
return;

pid_t exitedChildPid;
@@ -550,7 +550,7 @@ int createCOKit(const std::string& childRoot, const std::string& sysTemplate,
const auto startForkingTime = std::chrono::steady_clock::now();

pid_t childPid = 0;
- if (Util::isKitInProcess())
+ if constexpr (Util::isKitInProcess())
{
std::thread([childRoot, jailId = std::move(jailId), configId, sysTemplate,
loTemplate, queryVersion
@@ -829,7 +829,7 @@ int forkit_main(int argc, char** argv)

Util::sleepFromEnvIfSet("Forkit", "SLEEPFORDEBUGGER");

- if (!Util::isKitInProcess())
+ if constexpr (!Util::isKitInProcess())
{
// Already set by COOLWSD.cpp in kit in process
SigUtil::setFatalSignals("forkit startup of " + Util::getCoolVersion() + ' ' +
@@ -848,7 +848,7 @@ int forkit_main(int argc, char** argv)
if (simd::init())
simd_deltaInit();

- if (!Util::isKitInProcess())
+ if constexpr (!Util::isKitInProcess())
Util::setApplicationPath(Poco::Path(argv[0]).parent().toString());

// Initialization
@@ -1042,7 +1042,7 @@ int forkit_main(int argc, char** argv)
JailUtil::SysTemplate::setupRandomDeviceLinks(sysTemplate);
#endif

- if (!Util::isKitInProcess())
+ if constexpr (!Util::isKitInProcess())
{
// Parse the configuration.
char* const conf = std::getenv("COOL_CONFIG");
diff --git a/kit/Kit.cpp b/kit/Kit.cpp
index 65a8a019742b..c8696141641d 100644
--- a/kit/Kit.cpp
+++ b/kit/Kit.cpp
@@ -2772,7 +2772,7 @@ void Document::flushAndExit(int code)
{
flushTraceEventRecordings();
_deltaPool.stop();
- if (!Util::isKitInProcess())
+ if constexpr (!Util::isKitInProcess())
Util::forcedExit(code);
else
SigUtil::setTerminationFlag();
@@ -3442,7 +3442,7 @@ void lokit_main(
{
#if !MOBILEAPP

- if (!Util::isKitInProcess())
+ if constexpr (!Util::isKitInProcess())
{
// Already set by COOLWSD.cpp
SigUtil::setFatalSignals("kit startup of " + Util::getCoolVersion() + ' ' +
@@ -3925,7 +3925,7 @@ void lokit_main(
if (!initFunction)
initFunction = cok_init_2;

- if (!Util::isKitInProcess())
+ if constexpr (!Util::isKitInProcess())
kit = UnitKit::get().cok_init(instdir, userdir, initFunction);
if (!kit)
kit = initFunction(instdir, userdir);
@@ -4183,7 +4183,7 @@ void lokit_main(

LOG_INF("Kit process for Jail [" << jailId << "] finished.");
flushTraceEventRecordings();
- if (!Util::isKitInProcess())
+ if constexpr (!Util::isKitInProcess())
Util::forcedExit(EX_OK);

#endif
diff --git a/kit/KitWebSocket.cpp b/kit/KitWebSocket.cpp
index 186f4e6cd8b6..8bf924d9412d 100644
--- a/kit/KitWebSocket.cpp
+++ b/kit/KitWebSocket.cpp
@@ -126,7 +126,7 @@ void KitWebSocketHandler::handleMessage(const std::vector<char>& data)
if (_document)
_document->joinThreads();
_document.reset();
- if (!Util::isKitInProcess())
+ if constexpr (!Util::isKitInProcess())
Util::forcedExit(EX_OK);
else
SigUtil::setTerminationFlag();
diff --git a/wsd/Admin.cpp b/wsd/Admin.cpp
index a74b780d8ca8..b101511172ef 100644
--- a/wsd/Admin.cpp
+++ b/wsd/Admin.cpp
@@ -1107,7 +1107,7 @@ void Admin::cleanupResourceConsumingDocs()

void Admin::cleanupLostKits()
{
- if (Util::isKitInProcess())
+ if constexpr (Util::isKitInProcess())
return; // we might look lost ourselves.

static std::map<pid_t, std::time_t> mapKitsLost;
diff --git a/wsd/COOLWSD.cpp b/wsd/COOLWSD.cpp
index dcba08cb90a7..da84dff4ca57 100644
--- a/wsd/COOLWSD.cpp
+++ b/wsd/COOLWSD.cpp
@@ -546,7 +546,7 @@ void COOLWSD::cleanupDocBrokers()
/// Forks as many children as requested.
static void forkChildren(const std::string& configId, const int number)
{
- if (Util::isKitInProcess())
+ if constexpr (Util::isKitInProcess())
return;

LOG_TRC("Request forkit to spawn " << number << " new child(ren)");
@@ -572,7 +572,7 @@ static bool queueMessageToForKit(const std::string& message);

bool COOLWSD::ensureSubForKit(const std::string& configId)
{
- if (Util::isKitInProcess())
+ if constexpr (Util::isKitInProcess())
return false;

LOG_TRC("Request forkit to spawn subForKit " << configId);
@@ -594,7 +594,7 @@ bool COOLWSD::ensureSubForKit(const std::string& configId)
/// Cleans up dead children.
static void cleanupChildren()
{
- if (Util::isKitInProcess())
+ if constexpr (Util::isKitInProcess())
return;

Util::assertIsLocked(NewChildrenMutex);
@@ -2087,7 +2087,7 @@ void COOLWSD::innerInitialize(Poco::Util::Application& self)
ConfigUtil::getConfigValue("indirection_endpoint.geolocation_setup.enable", false);

#if ENABLE_DEBUG
- if (Util::isKitInProcess())
+ if constexpr (Util::isKitInProcess())
SingleKit = true;
#endif
#endif
@@ -2650,7 +2650,7 @@ bool COOLWSD::checkAndRestoreForKit()
}
}

- if (Util::isKitInProcess())
+ if constexpr (Util::isKitInProcess())
return true;

int status;
@@ -2937,7 +2937,7 @@ bool COOLWSD::createForKit()
// Always reap first, in case we haven't done so yet.
if (ForKitProcId != -1)
{
- if (Util::isKitInProcess())
+ if constexpr (Util::isKitInProcess())
return true;
int status;
waitpid(ForKitProcId, &status, WUNTRACED | WNOHANG);
@@ -3796,7 +3796,7 @@ void COOLWSD::innerMain()
// No need to "have at least one child" beforehand on mobile
#if !MOBILEAPP

- if (!Util::isKitInProcess())
+ if constexpr (!Util::isKitInProcess())
{
// Make sure we have at least one child before moving forward.
std::unique_lock<std::mutex> lock(NewChildrenMutex);
@@ -4143,7 +4143,7 @@ void COOLWSD::innerMain()
}

#if !MOBILEAPP
- if (!Util::isKitInProcess())
+ if constexpr (!Util::isKitInProcess())
{
// Terminate child processes
LOG_INF("Requesting forkit process " << ForKitProcId << " to terminate.");
@@ -4188,7 +4188,7 @@ void COOLWSD::innerMain()
SigUtil::addActivity("terminated unused children");

#if !MOBILEAPP
- if (!Util::isKitInProcess())
+ if constexpr (!Util::isKitInProcess())
{
SigUtil::addActivity("waiting for forkit to exit");

@@ -4463,7 +4463,7 @@ void forwardSigUsr2()
#if !MOBILEAPP
LOG_TRC("forwardSigUsr2");

- if (Util::isKitInProcess())
+ if constexpr (Util::isKitInProcess())
return;

Util::assertIsLocked(DocBrokersMutex);
commit e980e857a5980824144d019370c8ac95ea2886e5
Author: Areg Nakashian <areg.na...@gmail.com>
AuthorDate: Sun Apr 26 14:32:20 2026 -0400
Commit: Ashod Nakashian <ashod.n...@collabora.co.uk>
CommitDate: Wed Apr 29 09:20:43 2026 +0000

common: test: wsd: Remove setKitInProcess and kitInProcess

Signed-off-by: Areg Nakashian <areg.na...@gmail.com>
Change-Id: Icdff5fe5534dc14df2c9955a45794fa65090793d
Reviewed-on: https://gerrit.collaboraoffice.com/c/online/+/1694
Reviewed-by: Ashod Nakashian <ashod.n...@collabora.co.uk>
Tested-by: Jenkins CPCI <rel...@collaboraoffice.com>

diff --git a/common/Util.cpp b/common/Util.cpp
index 87612f66793d..fcac88cdcb17 100644
--- a/common/Util.cpp
+++ b/common/Util.cpp
@@ -185,9 +185,6 @@ namespace Util
return std::getenv("DISPLAY") != nullptr;
}

- bool kitInProcess = false;
- void setKitInProcess(bool value) { kitInProcess = value; }
-
std::string replace(std::string result, const std::string_view from, const std::string_view to)
{
const std::size_t fromSize = from.size();
diff --git a/common/Util.hpp b/common/Util.hpp
index 8bc6777ed2f2..41b1c415672d 100644
--- a/common/Util.hpp
+++ b/common/Util.hpp
@@ -1108,7 +1108,6 @@ int main(int argc, char**argv)
#endif
}

- void setKitInProcess(bool value);
constexpr bool isKitInProcess()
{
#if defined(ENABLE_INPROC) && ENABLE_INPROC
diff --git a/test/ClientTestStubs.cpp b/test/ClientTestStubs.cpp
index 0a9b0b75e26a..e8b8defbedd2 100644
--- a/test/ClientTestStubs.cpp
+++ b/test/ClientTestStubs.cpp
@@ -23,8 +23,6 @@
#include <wsd/RequestDetails.hpp>

// ----- Kit stubs -----
-void setKitInProcess() {}
-
#include <kit/ChildSession.hpp>
bool ChildSession::NoCapsForKit = true;

diff --git a/wsd/COOLWSD.cpp b/wsd/COOLWSD.cpp
index f8c51f987693..dcba08cb90a7 100644
--- a/wsd/COOLWSD.cpp
+++ b/wsd/COOLWSD.cpp
@@ -4515,7 +4515,6 @@ int main(int argc, char** argv)
{
SigUtil::setUserSignals();
SigUtil::setFatalSignals("wsd " + Util::getCoolVersion() + ' ' + Util::getCoolVersionHash());
- setKitInProcess();

try
{
diff --git a/wsd/COOLWSD.hpp b/wsd/COOLWSD.hpp
index 8eae97a2330c..47612bac6374 100644
--- a/wsd/COOLWSD.hpp
+++ b/wsd/COOLWSD.hpp
@@ -319,8 +319,6 @@ private:
std::unordered_map<std::string, std::string> _overrideSettings;
};

-void setKitInProcess();
-
int createForkit(const std::string& forKitPath, const StringVector& args);

/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/wsd/coolwsd-fork.cpp b/wsd/coolwsd-fork.cpp
index 08b122250b59..65fe66a2d4a4 100644
--- a/wsd/coolwsd-fork.cpp
+++ b/wsd/coolwsd-fork.cpp
@@ -21,8 +21,6 @@
#include <common/Util.hpp>
#include <wsd/COOLWSD.hpp>

-void setKitInProcess() { Util::setKitInProcess(false); }
-
int createForkit(const std::string& forKitPath, const StringVector& args)
{
// create forkit in a process
diff --git a/wsd/coolwsd-inproc.cpp b/wsd/coolwsd-inproc.cpp
index a630e8808826..e4d9b0320e26 100644
--- a/wsd/coolwsd-inproc.cpp
+++ b/wsd/coolwsd-inproc.cpp
@@ -21,8 +21,6 @@
#include <COOLWSD.hpp>
#include <Kit.hpp>

-void setKitInProcess() { Util::setKitInProcess(true); }
-
int createForkit(const std::string& forKitPath, const StringVector& args)
{
// create forkit in a thread

Reply all
Reply to author
Forward
0 new messages