diff options
author | Andy Wingo <wingo@pobox.com> | 2015-08-23 14:54:39 +0200 |
---|---|---|
committer | Andy Wingo <wingo@pobox.com> | 2015-08-23 14:54:39 +0200 |
commit | ef2aa93b7a4c742ae74496566344fd71e411fa72 (patch) | |
tree | 77a378fd74d1e7ee0c602d7a853a1a5b85076903 /src/login/logind-dbus.c | |
parent | 06ca7594edc2bf54a32f0fe86fc65976c70f1f11 (diff) |
Handle suspend/hibernate/hybrid-suspend/shutdown/reboot directly
* configure.ac: Get paths of halt and reboot.
* Makefile.am (systemsleepdir, systemshutdowndir): New variables. Look
in them for hooks to run.
* src/login/logind-action.c: Inline the salient bits from systemd's
system-sleep.c here.
* src/login/logind-dbus.c (execute_shutdown_or_sleep): Call our own
shutdown_or_sleep helper instead of invoking a systemd method.
* src/login/logind.h: Declare shutdown_or_sleep.
Diffstat (limited to 'src/login/logind-dbus.c')
-rw-r--r-- | src/login/logind-dbus.c | 22 |
1 files changed, 1 insertions, 21 deletions
diff --git a/src/login/logind-dbus.c b/src/login/logind-dbus.c index b735366fe1..301c4de2fe 100644 --- a/src/login/logind-dbus.c +++ b/src/login/logind-dbus.c @@ -1422,10 +1422,6 @@ static int execute_shutdown_or_sleep( InhibitWhat w, HandleAction action, sd_bus_error *error) { - - _cleanup_bus_message_unref_ sd_bus_message *reply = NULL; - const char *p; - char *c; int r; assert(m); @@ -1436,26 +1432,10 @@ static int execute_shutdown_or_sleep( /* FIXME: here do the thing. */ - r = sd_bus_call_method( - m->bus, - "org.freedesktop.systemd1", - "/org/freedesktop/systemd1", - "org.freedesktop.systemd1.Manager", - "StartUnit", - error, - &reply, - "ss", NULL, "replace-irreversibly"); + r = shutdown_or_sleep(action); if (r < 0) return r; - r = sd_bus_message_read(reply, "o", &p); - if (r < 0) - return r; - - c = strdup(p); - if (!c) - return -ENOMEM; - /* Make sure the lid switch is ignored for a while (?) */ manager_set_lid_switch_ignore(m, now(CLOCK_MONOTONIC) + m->holdoff_timeout_usec); |