diff options
| author | Dan Engelbrecht <[email protected]> | 2025-01-15 10:17:02 +0100 |
|---|---|---|
| committer | Dan Engelbrecht <[email protected]> | 2025-01-15 10:17:02 +0100 |
| commit | 53531a6b22dbb7b690db43964172e9d0f670c3c8 (patch) | |
| tree | eb826db2e3f8601df32f166f96fa291cc9e80de3 /src | |
| parent | systemd unit file, incomplete (diff) | |
| download | zen-53531a6b22dbb7b690db43964172e9d0f670c3c8.tar.xz zen-53531a6b22dbb7b690db43964172e9d0f670c3c8.zip | |
clang format
Diffstat (limited to 'src')
| -rw-r--r-- | src/zencore/process.cpp | 2 | ||||
| -rw-r--r-- | src/zenserver/main.cpp | 5 | ||||
| -rw-r--r-- | src/zenutil/service.cpp | 25 | ||||
| -rw-r--r-- | src/zenutil/zenserverprocess.cpp | 2 |
4 files changed, 19 insertions, 15 deletions
diff --git a/src/zencore/process.cpp b/src/zencore/process.cpp index 8049130da..8e903f05f 100644 --- a/src/zencore/process.cpp +++ b/src/zencore/process.cpp @@ -855,7 +855,7 @@ IsProcessRunning(int pid, std::error_code& OutEc) } else if (Error == EPERM) { - return true; // Running under a user we don't have access to, assume it is live + return true; // Running under a user we don't have access to, assume it is live } else { diff --git a/src/zenserver/main.cpp b/src/zenserver/main.cpp index 6bf369ca4..f35010866 100644 --- a/src/zenserver/main.cpp +++ b/src/zenserver/main.cpp @@ -313,7 +313,10 @@ ZenEntryPoint::Run() } catch (const std::system_error& e) { - ZEN_CRITICAL("Caught system error exception in main for process {}: {} ({})", zen::GetCurrentProcessId(), e.what(), e.code().value()); + ZEN_CRITICAL("Caught system error exception in main for process {}: {} ({})", + zen::GetCurrentProcessId(), + e.what(), + e.code().value()); RequestApplicationExit(1); } catch (const std::exception& e) diff --git a/src/zenutil/service.cpp b/src/zenutil/service.cpp index 820edf565..45874d1b5 100644 --- a/src/zenutil/service.cpp +++ b/src/zenutil/service.cpp @@ -280,13 +280,13 @@ namespace { } } - while(!Data.empty() && isspace(Data[Data.length() - 1])) + while (!Data.empty() && isspace(Data[Data.length() - 1])) { Data.pop_back(); } - int Res = -1; - int Status = pclose(Stream); + int Res = -1; + int Status = pclose(Stream); if (Status < 0) { return {Status, Data}; @@ -296,7 +296,7 @@ namespace { { Res = WEXITSTATUS(Status); } - if (Res != 0 && Res != (128+13)) + if (Res != 0 && Res != (128 + 13)) { return {Res, Data}; } @@ -883,10 +883,10 @@ InstallService(std::string_view ServiceName, const ServiceSpec& Spec) { // TODO: Do we need to create a separate user for the service or is running as root OK? - const std::string UnitName = GetUnitName(ServiceName); + const std::string UnitName = GetUnitName(ServiceName); const std::filesystem::path ServiceUnitPath = GetServiceUnitPath(UnitName); - std::string UnitFile = BuildUnitFile(ServiceName, Spec.ExecutablePath, Spec.CommandLineOptions, UnitName); + std::string UnitFile = BuildUnitFile(ServiceName, Spec.ExecutablePath, Spec.CommandLineOptions, UnitName); ZEN_DEBUG("Writing systemd unit file to {}", ServiceUnitPath.string()); try { @@ -923,7 +923,7 @@ InstallService(std::string_view ServiceName, const ServiceSpec& Spec) std::error_code UninstallService(std::string_view ServiceName) { - const std::string UnitName = GetUnitName(ServiceName); + const std::string UnitName = GetUnitName(ServiceName); const std::filesystem::path ServiceUnitPath = GetServiceUnitPath(UnitName); std::pair<int, std::string> Res = ExecuteProgram(fmt::format("systemctl disable {}", UnitName)); @@ -955,7 +955,7 @@ UninstallService(std::string_view ServiceName) std::error_code QueryInstalledService(std::string_view ServiceName, ServiceInfo& OutInfo) { - const std::string UnitName = GetUnitName(ServiceName); + const std::string UnitName = GetUnitName(ServiceName); const std::filesystem::path ServiceUnitPath = GetServiceUnitPath(UnitName); OutInfo.Status = ServiceStatus::NotInstalled; @@ -973,7 +973,7 @@ QueryInstalledService(std::string_view ServiceName, ServiceInfo& OutInfo) } else { - ZEN_DEBUG("systemctl status failed with '{}" ({}), Res.second, Res.first); + ZEN_DEBUG("systemctl status failed with '{}"({}), Res.second, Res.first); } } @@ -988,7 +988,7 @@ StartService(std::string_view ServiceName) // Starting the same command line for the service using `sudo` *will* start the service sucessfully so I // assume that the Unit file or some config is wrong/missing. - const std::string UnitName = GetUnitName(ServiceName); + const std::string UnitName = GetUnitName(ServiceName); const std::filesystem::path ServiceUnitPath = GetServiceUnitPath(UnitName); std::pair<int, std::string> Res = ExecuteProgram(fmt::format("systemctl start {}", UnitName)); @@ -1004,9 +1004,10 @@ StartService(std::string_view ServiceName) std::error_code StopService(std::string_view ServiceName) { - // TODO: Stopping the service returns -1 from ExecuteProgram, maybe this ie expected as I have yet to successfully start the service using systemctl start + // TODO: Stopping the service returns -1 from ExecuteProgram, maybe this ie expected as I have yet to successfully start the service + // using systemctl start - const std::string UnitName = GetUnitName(ServiceName); + const std::string UnitName = GetUnitName(ServiceName); const std::filesystem::path ServiceUnitPath = GetServiceUnitPath(UnitName); std::pair<int, std::string> Res = ExecuteProgram(fmt::format("systemctl stop {}", UnitName)); diff --git a/src/zenutil/zenserverprocess.cpp b/src/zenutil/zenserverprocess.cpp index 3b7bf5ad4..0c0882311 100644 --- a/src/zenutil/zenserverprocess.cpp +++ b/src/zenutil/zenserverprocess.cpp @@ -167,7 +167,7 @@ ZenServerState::Initialize() ThrowLastError("Could not map view of Zen server state"); } #else -ZEN_INFO("{}", S_IRUSR | S_IWUSR | S_IXUSR); + ZEN_INFO("{}", S_IRUSR | S_IWUSR | S_IXUSR); int Fd = shm_open("/UnrealEngineZen", O_RDWR | O_CREAT | O_CLOEXEC, geteuid() == 0 ? 0766 : 0666); if (Fd < 0) { |