diff --git a/construct/signals.cc b/construct/signals.cc index f3ba8ab6d..4bc597687 100644 --- a/construct/signals.cc +++ b/construct/signals.cc @@ -250,7 +250,7 @@ void construct::handle_cont() try { - ircd::cont(); + ircd::ios::continuing(); } catch(const std::exception &e) { diff --git a/include/ircd/ios/ios.h b/include/ircd/ios/ios.h index 2bfc0488d..2cb72c05e 100644 --- a/include/ircd/ios/ios.h +++ b/include/ircd/ios/ios.h @@ -34,9 +34,12 @@ namespace ircd::ios bool available() noexcept; const uint64_t &epoch() noexcept; - void forked_parent(); - void forked_child(); - void forking(); + void forking(); // fork prepare + void forked_child(); // on fork child + void forked_parent(); // on fork parent + void continuing() noexcept; // on SIGCONT + void exiting() noexcept; // on atexit + void exiting_quick() noexcept; // on at_quick_exit void init(asio::executor &&); } diff --git a/include/ircd/ircd.h b/include/ircd/ircd.h index 6aa92c345..9a0a77948 100644 --- a/include/ircd/ircd.h +++ b/include/ircd/ircd.h @@ -154,7 +154,6 @@ namespace ircd seconds uptime(); // Control panel - void cont() noexcept; bool quit() noexcept; void init(boost::asio::executor &&, user_main); } diff --git a/ircd/ios.cc b/ircd/ios.cc index 3da30b3d9..c018c8050 100644 --- a/ircd/ios.cc +++ b/ircd/ios.cc @@ -79,7 +79,75 @@ ircd::ios::init(asio::executor &&user) ios::main = *ios::primary; } -[[using gnu: cold, visibility("hidden")]] +[[using gnu: cold]] +void +ircd::ios::exiting_quick() +noexcept +{ + if(run::level == run::level::HALT) + return; + + if(ircd::debugmode) + log::logf + { + log::star, log::level::DEBUG, + "IRCd notified of quick exit() in runlevel:%s ctx:%p", + reflect(run::level), + (const void *)ctx::current, + }; +} + +[[using gnu: cold]] +void +ircd::ios::exiting() +noexcept +{ + if(run::level == run::level::HALT) + return; + + if(ircd::debugmode) + log::logf + { + log::star, log::level::DEBUG, + "IRCd notified of exit() in runlevel:%s ctx:%p", + reflect(run::level), + (const void *)ctx::current, + }; +} + +[[using gnu: cold]] +void +ircd::ios::continuing() +noexcept +{ + if(run::level == run::level::HALT) + return; + + log::logf + { + log::star, log::level::DEBUG, + "IRCd notified of SIGCONT in runlevel:%s ctx:%p", + reflect(run::level), + (const void *)ctx::current, + }; + + switch(run::level) + { + case run::level::RUN: + break; + + default: + return; + } + + log::notice + { + log::star, "IRCd resuming service in runlevel %s.", + reflect(run::level), + }; +} + +[[using gnu: cold]] void ircd::ios::forking() { @@ -90,7 +158,7 @@ ircd::ios::forking() #endif } -[[using gnu: cold, visibility("hidden")]] +[[using gnu: cold]] void ircd::ios::forked_child() { @@ -101,7 +169,7 @@ ircd::ios::forked_child() #endif } -[[using gnu: cold, visibility("hidden")]] +[[using gnu: cold]] void ircd::ios::forked_parent() { diff --git a/ircd/ircd.cc b/ircd/ircd.cc index 99f694d52..920c4b2a3 100644 --- a/ircd/ircd.cc +++ b/ircd/ircd.cc @@ -293,39 +293,6 @@ noexcept return false; } -/// Notifies IRCd that execution is being resumed after a significant gap. -/// Basically this is connected to a SIGCONT handler and beneficial after -/// user stops, debugging and ACPI suspensions, etc. It is not required at -/// this time, but its connection is advised for best behavior. -void -ircd::cont() -noexcept -{ - log::logf - { - log::star, log::level::DEBUG, - "IRCd cont requested from runlevel:%s ctx:%p main_context:%p", - reflect(run::level), - (const void *)ctx::current, - (const void *)main_context - }; - - switch(run::level) - { - case run::level::RUN: - break; - - default: - return; - } - - log::notice - { - log::star, "IRCd resuming service in runlevel %s.", - reflect(run::level), - }; -} - /// Main context; Main program. Do not call this function directly. /// /// This function manages the lifetime for all resources and subsystems diff --git a/modules/console.cc b/modules/console.cc index ff6ee4f2f..085c0a1d9 100644 --- a/modules/console.cc +++ b/modules/console.cc @@ -2796,7 +2796,7 @@ console_cmd__ctx__interrupt(opt &out, const string_view &line) }}; size_t count(0); - for(size_t i(0); i < param.count() && cont; ++i) + for(size_t i(0); i < param.count(); ++i) count += !ctx::for_each([&](auto &ctx) { if(id(ctx) == param.at(i)) @@ -2866,7 +2866,7 @@ console_cmd__ctx__term(opt &out, const string_view &line) }}; size_t count(0); - for(size_t i(0); i < param.count() && cont; ++i) + for(size_t i(0); i < param.count(); ++i) count += !ctx::for_each([&](auto &ctx) { if(id(ctx) == param.at(i))