Commit 54caca8d authored by jan.koester's avatar jan.koester
Browse files

tst

parent 0c742287
Loading
Loading
Loading
Loading
+1 −1
Changes for CMakeLists.txt: 1 added line, 1 removed line.
Original line number Diff line number Diff line
cmake_minimum_required(VERSION 3.18)

project(syslite VERSION 1.1.3 LANGUAGES CXX)
project(syslite VERSION 1.1.4 LANGUAGES CXX)

set(CMAKE_CXX_STANDARD 17)
set(CMAKE_CXX_STANDARD_REQUIRED ON)
+8 −1
Changes for include/sysbus/client.h: 8 added lines, 1 removed line.
Original line number Diff line number Diff line
@@ -17,6 +17,12 @@
#include <string>
#include <vector>

// Exists (holding "reboot" or "poweroff") while syslite stops the services
// for a shutdown, so a daemon can tell that SIGTERM from a restart: e.g.
// iscsid logs out of its targets then, but keeps the sessions on a restart.
// The network is still up at that point; sysbus is already gone.
#define SYSLITE_SHUTDOWN_FILE "/run/syslite/shutdown"

namespace sysbus {

// The syslite methods and signals.
@@ -32,7 +38,8 @@ constexpr const char *Reload = "Reload";
constexpr const char *Subscribe = "Subscribe";

// Power: stop all services, sync, unmount, reboot or power off -- after
// a second, so the caller can still pass its reply on. Root only.
// a second, so the caller can still pass its reply on. Root only. While
// the services are stopped, SYSLITE_SHUTDOWN_FILE exists (see below).
constexpr const char *Reboot = "Reboot";
constexpr const char *PowerOff = "PowerOff";

+11 −0
Changes for src/syslite.cpp: 11 added lines, 0 removed lines.
Original line number Diff line number Diff line
@@ -96,6 +96,10 @@ namespace syslite {

        // Mount /tmp
        mount("tmpfs", "/tmp", "tmpfs", MS_NOSUID | MS_NODEV, "mode=1777");

        // a /run that outlived a shutdown must not say it's still going on
        std::error_code ec;
        std::filesystem::remove(SYSLITE_SHUTDOWN_FILE, ec);
    }

    void Init::setHostname() {
@@ -747,6 +751,13 @@ namespace syslite {
        std::cout << std::endl;
        std::cout << "[syslite] Shutting down..." << std::endl;

        // tell the services this SIGTERM is the shutdown, not a restart
        {
            std::error_code ec;
            std::filesystem::create_directories(std::filesystem::path(SYSLITE_SHUTDOWN_FILE).parent_path(), ec);
            std::ofstream(SYSLITE_SHUTDOWN_FILE) << (doReboot.load() ? "reboot" : "poweroff") << "\n";
        }

        _network.stopDeviceMonitor();
        _modules.stopMonitor();
        _ttys.stopAll();