-/*-*- Mode: C; c-basic-offset: 8; indent-tabs-mode: nil -*-*/
-
+/* SPDX-License-Identifier: LGPL-2.1+ */
/***
This file is part of systemd.
#include "cgroup-util.h"
#include "dirent-util.h"
#include "fd-util.h"
-#include "formats-util.h"
+#include "format-util.h"
#include "hostname-util.h"
#include "label.h"
#include "machine-image.h"
#include "machined.h"
+#include "process-util.h"
#include "signal-util.h"
Manager *manager_new(void) {
assert(m);
+ while (m->operations)
+ operation_free(m->operations);
+
+ assert(m->n_operations == 0);
+
while ((machine = hashmap_first(m->machines)))
machine_free(machine);
}
static int manager_connect_bus(Manager *m) {
- _cleanup_bus_error_free_ sd_bus_error error = SD_BUS_ERROR_NULL;
+ _cleanup_(sd_bus_error_free) sd_bus_error error = SD_BUS_ERROR_NULL;
int r;
assert(m);
machine_get_state(machine) != MACHINE_CLOSING)
machine_stop(machine);
- /* Now, the stop stop probably made this referenced
+ /* Now, the stop probably made this referenced
* again, but if it didn't, then it's time to let it
* go entirely. */
if (!machine_check_gc(machine, drop_not_started)) {
static bool check_idle(void *userdata) {
Manager *m = userdata;
+ if (m->operations)
+ return false;
+
manager_gc(m, true);
return hashmap_isempty(m->machines);
goto finish;
}
- log_debug("systemd-machined running as pid "PID_FMT, getpid());
+ log_debug("systemd-machined running as pid "PID_FMT, getpid_cached());
sd_notify(false,
"READY=1\n"
r = manager_run(m);
- log_debug("systemd-machined stopped as pid "PID_FMT, getpid());
+ log_debug("systemd-machined stopped as pid "PID_FMT, getpid_cached());
finish:
manager_free(m);