mirror of
https://github.com/troglobit/finit.git
synced 2026-11-13 17:00:16 +00:00
dbus: honor the shutdown timeout in the reboot family
initctl -t N reboot arms an emergency bypass timer over the legacy socket, but the bus methods took no argument, so the timeout was silently dropped whenever D-Bus was up. Reboot, Halt, and Poweroff now take a timeout in seconds, 0 for none, armed via the same shutdown_bypass() the legacy path uses. Signed-off-by: Joachim Wiberg <troglobit@gmail.com>
This commit is contained in:
6 files changed
+55
-24
No files matched your search
@@ -94,6 +94,29 @@ static void shutdown_wdt_cb(uev_t *w, void *arg, int events)
|
||||
do_shutdown(halt);
|
||||
}
|
||||
|
||||
/*
|
||||
* Emergency shutdown bypass, same job as the shutdown watchdog above
|
||||
* but armed by the user: `initctl -t SEC reboot`, on either transport.
|
||||
*/
|
||||
static void bypass_shutdown(void *unused)
|
||||
{
|
||||
(void)unused;
|
||||
|
||||
cprintf("TIMEOUT TIMEOUT SHUTTING DOWN NOW!!\n");
|
||||
do_shutdown(halt);
|
||||
}
|
||||
|
||||
static struct wq emergency = { .cb = bypass_shutdown };
|
||||
|
||||
void shutdown_bypass(int timeout)
|
||||
{
|
||||
if (timeout <= 0)
|
||||
return;
|
||||
|
||||
emergency.delay = timeout * 1000;
|
||||
schedule_work(&emergency);
|
||||
}
|
||||
|
||||
/*
|
||||
* User-requested runlevel change, shared by the legacy API and the
|
||||
* D-Bus SetRunlevel method. Refused in runlevel 0/6, deferred via
|
||||
|
||||
Reference in new issue
Block a user