#include "strv.h"
#include "mkdir.h"
#include "path-util.h"
-#include "special.h"
+// #include "special.h"
#include "sleep-config.h"
#include "fileio-label.h"
#include "unit-name.h"
if (r < 0)
return r;
+ session_add_to_gc_queue(session);
+
return sd_bus_reply_method_return(message, NULL);
}
return r;
}
+static int send_prepare_for(Manager *m, InhibitWhat w, bool _active) {
+
+ static const char * const signal_name[_INHIBIT_WHAT_MAX] = {
+ [INHIBIT_SHUTDOWN] = "PrepareForShutdown",
+ [INHIBIT_SLEEP] = "PrepareForSleep"
+ };
+
+ int active = _active;
+
+ assert(m);
+ assert(w >= 0);
+ assert(w < _INHIBIT_WHAT_MAX);
+ assert(signal_name[w]);
+
+ return sd_bus_emit_signal(m->bus,
+ "/org/freedesktop/login1",
+ "org.freedesktop.login1.Manager",
+ signal_name[w],
+ "b",
+ active);
+}
+
static int execute_shutdown_or_sleep(
Manager *m,
InhibitWhat w,
m->action_what = w;
#endif // 0
+ if (w == INHIBIT_SLEEP)
+ /* And we're back. */
+ send_prepare_for(m, w, false);
+
+ m->action_what = 0;
+
/* Make sure the lid switch is ignored for a while */
manager_set_lid_switch_ignore(m, now(CLOCK_MONOTONIC) + m->holdoff_timeout_usec);
return 0;
}
-static int send_prepare_for(Manager *m, InhibitWhat w, bool _active) {
-
- static const char * const signal_name[_INHIBIT_WHAT_MAX] = {
- [INHIBIT_SHUTDOWN] = "PrepareForShutdown",
- [INHIBIT_SLEEP] = "PrepareForSleep"
- };
-
- int active = _active;
-
- assert(m);
- assert(w >= 0);
- assert(w < _INHIBIT_WHAT_MAX);
- assert(signal_name[w]);
-
- return sd_bus_emit_signal(m->bus,
- "/org/freedesktop/login1",
- "org.freedesktop.login1.Manager",
- signal_name[w],
- "b",
- active);
-}
-
int bus_manager_shutdown_or_sleep_now_or_later(
Manager *m,
HandleAction action,
m->scheduled_shutdown_timeout_source = sd_event_source_unref(m->scheduled_shutdown_timeout_source);
m->wall_message_timeout_source = sd_event_source_unref(m->wall_message_timeout_source);
m->nologin_timeout_source = sd_event_source_unref(m->nologin_timeout_source);
- free(m->scheduled_shutdown_type);
- m->scheduled_shutdown_type = NULL;
+ m->scheduled_shutdown_type = mfree(m->scheduled_shutdown_type);
m->scheduled_shutdown_timeout = 0;
if (cancelled) {
return 0;
}
-#endif // 0
int match_unit_removed(sd_bus_message *message, void *userdata, sd_bus_error *error) {
const char *path, *unit;
return 0;
}
+#endif // 0
int manager_send_changed(Manager *manager, const char *property, ...) {
char **l;