STOPCANCELLED // Service was set to be stopped but a start was requested
};
+/* Shutdown types */
+enum class ShutdownType {
+ CONTINUE, // Continue normal boot sequence (used after single-user shell)
+ HALT, // Halt system without powering down
+ POWEROFF, // Power off system
+ REBOOT // Reboot system
+};
#endif
bool restart_enabled; // whether automatic restart is enabled (allowed)
ControlConn *rollback_handler; // recieves notification when all services stopped
+ ShutdownType shutdown_type = ShutdownType::CONTINUE; // Shutdown type, if stopping
+
// Private methods
// Load a service description, and dependencies, if there is no existing
return active_services;
}
- void stop_all_services() noexcept
+ void stop_all_services(ShutdownType type = ShutdownType::HALT) noexcept
{
restart_enabled = false;
+ shutdown_type = type;
for (std::list<ServiceRecord *>::iterator i = records.begin(); i != records.end(); ++i) {
(*i)->stop();
}
return restart_enabled;
}
+ ShutdownType getShutdownType() noexcept
+ {
+ return shutdown_type;
+ }
+
// Set the rollback handler, which will be notified when all services have stopped.
// There can be only one rollback handler; attempts to set it when already set will
// fail. Returns true if successful.