summaryrefslogtreecommitdiff
path: root/src/login/logind.c
diff options
context:
space:
mode:
authorDaniel Mack <daniel@zonque.org>2015-04-20 15:27:15 +0200
committerDaniel Mack <daniel@zonque.org>2015-04-24 17:48:12 +0200
commit8aaa023ae78f3cb28db3edd87f96b21486810b91 (patch)
treed4ce5ef2429fc2fd42f750368d1ef8e9efb19332 /src/login/logind.c
parentb7aa9589e0bf37cd2682dee4528bd32a794d1363 (diff)
logind: add .ScheduleShutdown and .CancelScheduledShutdown methods
Add a method called ScheduleShutdown in org.freedesktop.login1.Manager which adds a timer to shut down the system at a later point in time. The first argument holds the type of the schedule that is about to happen, and must be one of 'reboot', 'halt' or 'poweroff'. The second argument specifies the absolute time, based on CLOCK_REALTIME in nanoseconds, at which the the operation should be executed. To cancel a previously scheduled shutdown, the CancelScheduledShutdown() can be called, which returns a bool, indicating whether a scheduled timeout was cancelled. Also add a new property called ScheduledShutdown which returns the equivalent to what was passed in via ScheduleShutdown, as '(st)' type.
Diffstat (limited to 'src/login/logind.c')
-rw-r--r--src/login/logind.c2
1 files changed, 2 insertions, 0 deletions
diff --git a/src/login/logind.c b/src/login/logind.c
index d8163ecf91..3a4afdd266 100644
--- a/src/login/logind.c
+++ b/src/login/logind.c
@@ -144,6 +144,7 @@ static void manager_free(Manager *m) {
sd_event_source_unref(m->idle_action_event_source);
sd_event_source_unref(m->inhibit_timeout_source);
+ sd_event_source_unref(m->scheduled_shutdown_timeout_source);
sd_event_source_unref(m->console_active_event_source);
sd_event_source_unref(m->udev_seat_event_source);
@@ -176,6 +177,7 @@ static void manager_free(Manager *m) {
strv_free(m->kill_only_users);
strv_free(m->kill_exclude_users);
+ free(m->scheduled_shutdown_type);
free(m->action_job);
free(m);
}